platform/upstream/llvm.git
9 years agoFix crashes on missing @interface for category
Ben Langmuir [Tue, 20 Jan 2015 20:41:36 +0000 (20:41 +0000)]
Fix crashes on missing @interface for category

In a few places we didn't check that Category->getClassInterface() was
not null before using it.

llvm-svn: 226605

9 years agoAdd the test that was supposed to be included with r223162.
Kaelyn Takata [Tue, 20 Jan 2015 20:15:29 +0000 (20:15 +0000)]
Add the test that was supposed to be included with r223162.

The test case is based on the reduction from PR21679 and has to be
freestanding to work correctly, since some of the expected errors (and
some of the problems that were fixed) only occur when the end of the
file is reached.

llvm-svn: 226603

9 years ago[Hexagon] Removing unnecessary clutter in intrinsic tests.
Colin LeMahieu [Tue, 20 Jan 2015 19:46:07 +0000 (19:46 +0000)]
[Hexagon] Removing unnecessary clutter in intrinsic tests.

llvm-svn: 226602

9 years agoImplement command line options for stack probe space
Hans Wennborg [Tue, 20 Jan 2015 19:45:50 +0000 (19:45 +0000)]
Implement command line options for stack probe space

This code adds the -mstack-probe-size command line option and implements the /Gs
compiler switch for clang-cl.

This should fix http://llvm.org/bugs/show_bug.cgi?id=21896

Patch by Andrew H!

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

llvm-svn: 226601

9 years agoPrevent binary-tree deterioration in sparse switch statements.
Daniel Jasper [Tue, 20 Jan 2015 19:43:33 +0000 (19:43 +0000)]
Prevent binary-tree deterioration in sparse switch statements.

This addresses part of llvm.org/PR22262. Specifically, it prevents
considering the densities of sub-ranges that have fewer than
TLI.getMinimumJumpTableEntries() elements. Those densities won't help
jump tables.

This is not a complete solution but works around the most pressing
issue.

Review: http://reviews.llvm.org/D7070
llvm-svn: 226600

9 years ago[GC] Verify-pass void vararg functions in gc.statepoint
Ramkumar Ramachandra [Tue, 20 Jan 2015 19:42:46 +0000 (19:42 +0000)]
[GC] Verify-pass void vararg functions in gc.statepoint

With the appropriate Verifier changes, exactracting the result out of a
statepoint wrapping a vararg function crashes. However, a void vararg
function works fine: commit this first step.

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

llvm-svn: 226599

9 years agoReapply: Teach SROA how to update debug info for fragmented variables.
Adrian Prantl [Tue, 20 Jan 2015 19:42:22 +0000 (19:42 +0000)]
Reapply: Teach SROA how to update debug info for fragmented variables.
This reapplies r225379.

ChangeLog:
- The assertion that this commit previously ran into about the inability
  to handle indirect variables has since been removed and the backend
  can handle this now.
- Testcases were upgrade to the new MDLocation format.
- Instead of keeping a DebugDeclares map, we now use
  llvm::FindAllocaDbgDeclare().

Original commit message follows.

Debug info: Teach SROA how to update debug info for fragmented variables.
This allows us to generate debug info for extremely advanced code such as

 typedef struct { long int a; int b;} S;

 int foo(S s) {
   return s.b;
 }

which at -O1 on x86_64 is codegen'd into

 define i32 @foo(i64 %s.coerce0, i32 %s.coerce1) #0 {
   ret i32 %s.coerce1, !dbg !24
 }

with this patch we emit the following debug info for this

 TAG_formal_parameter [3]
   AT_location( 0x00000000
                0x0000000000000000 - 0x0000000000000006: rdi, piece 0x00000008, rsi, piece 0x00000004
                0x0000000000000006 - 0x0000000000000008: rdi, piece 0x00000008, rax, piece 0x00000004 )
                AT_name( "s" )
                AT_decl_file( "/Volumes/Data/llvm/_build.ninja.release/test.c" )

Thanks to chandlerc, dblaikie, and echristo for their feedback on all
previous iterations of this patch!

llvm-svn: 226598

9 years agoR600/SI: Add subtarget feature to enable VGPR spilling for all shader types
Tom Stellard [Tue, 20 Jan 2015 19:33:04 +0000 (19:33 +0000)]
R600/SI: Add subtarget feature to enable VGPR spilling for all shader types

This is disabled by default, but can be enabled with the subtarget
feature: 'vgpr-spilling'

llvm-svn: 226597

9 years agoR600/SI: Fix simple-loop.ll test
Tom Stellard [Tue, 20 Jan 2015 19:33:02 +0000 (19:33 +0000)]
R600/SI: Fix simple-loop.ll test

llvm-svn: 226596

9 years agoReverted revision 226577.
Jozef Kolek [Tue, 20 Jan 2015 19:29:28 +0000 (19:29 +0000)]
Reverted revision 226577.

llvm-svn: 226595

9 years ago[PM] Clean up a bunch of the doxygen / API docs on the InstCombiner pass
Chandler Carruth [Tue, 20 Jan 2015 19:27:58 +0000 (19:27 +0000)]
[PM] Clean up a bunch of the doxygen / API docs on the InstCombiner pass
prior to refactoring it.

llvm-svn: 226594

9 years ago[llvm link] Destroy ConstantArrays in LLVMContext if they are not used.
Manman Ren [Tue, 20 Jan 2015 19:24:59 +0000 (19:24 +0000)]
[llvm link] Destroy ConstantArrays in LLVMContext if they are not used.

ConstantArrays constructed during linking can cause quadratic memory
explosion. An example is the ConstantArrays constructed when linking in
GlobalVariables with appending linkage.

Releasing all unused constants can cause a 20% LTO compile-time
slowdown for a large application. So this commit releases unused ConstantArrays
only.

rdar://19040716. It reduces memory footprint from 20+G to 6+G.

llvm-svn: 226592

9 years agoR600/SI: Remove stray debugging code from r226586
Tom Stellard [Tue, 20 Jan 2015 19:24:31 +0000 (19:24 +0000)]
R600/SI: Remove stray debugging code from r226586

llvm-svn: 226591

9 years agoDisable C4062 on Windows.
Zachary Turner [Tue, 20 Jan 2015 19:23:44 +0000 (19:23 +0000)]
Disable C4062 on Windows.

The use of std::future introduces an implicit dependency on the PPL
subcomponent of ConcRT.  ConcRT in general is pretty noisy with
warnings, so this patch just disables one of the noisy warnings.

llvm-svn: 226590

9 years ago[PM] Don't spend time making self moves no-ops. They're allowed to leave
Chandler Carruth [Tue, 20 Jan 2015 18:54:16 +0000 (18:54 +0000)]
[PM] Don't spend time making self moves no-ops. They're allowed to leave
the object in a moved-from state, and its simpler to write the code that
way.

llvm-svn: 226589

9 years agoAdd an assertion and prefer a crash over an infinite loop.
Adrian Prantl [Tue, 20 Jan 2015 18:03:37 +0000 (18:03 +0000)]
Add an assertion and prefer a crash over an infinite loop.

llvm-svn: 226588

9 years agoDon't remove backslashes from arguments unless the following char is recognized.
Zachary Turner [Tue, 20 Jan 2015 17:53:36 +0000 (17:53 +0000)]
Don't remove backslashes from arguments unless the following char is recognized.

This fixes file paths on Windows, as you can now write, for example,
file d:\foo\bar.txt, but does not break the case that this tokenization
logic was originally designed for, which is to allow escaping of things
like quotes and double quotes, so that all of the escapable characters
can appear in the same string together.

Reviewed by: Jim Ingham, Greg Clayton
Differential Revision: http://reviews.llvm.org/D7018

llvm-svn: 226587

9 years agoR600/SI: Use external symbols for scratch buffer
Tom Stellard [Tue, 20 Jan 2015 17:49:47 +0000 (17:49 +0000)]
R600/SI: Use external symbols for scratch buffer

We were passing the scratch buffer address to the shaders via user sgprs,
but now we use external symbols and have the driver patch the shader
using reloc information.

llvm-svn: 226586

9 years agoR600/SI: Add kill flag when copying scratch offset to a register
Tom Stellard [Tue, 20 Jan 2015 17:49:45 +0000 (17:49 +0000)]
R600/SI: Add kill flag when copying scratch offset to a register

This allows us to re-use the same register for the scratch offset
when accessing large private arrays.

llvm-svn: 226585

9 years agoR600/SI: Don't store scratch buffer frame index in MUBUF offset field
Tom Stellard [Tue, 20 Jan 2015 17:49:43 +0000 (17:49 +0000)]
R600/SI: Don't store scratch buffer frame index in MUBUF offset field

We don't have a good way of legalizing this if the frame index offset
is more than the 12-bits, which is size of MUBUF's offset field, so
now we store the frame index in the vaddr field.

llvm-svn: 226584

9 years agoR600/SI: Update SIInstrInfo:verifyInstruction() after r225662
Tom Stellard [Tue, 20 Jan 2015 17:49:41 +0000 (17:49 +0000)]
R600/SI: Update SIInstrInfo:verifyInstruction() after r225662

Now that we have our own custom register operand types, we need
to handle them in the verifiier.

llvm-svn: 226583

9 years agoSilencing a -Wunused-variable warning in non-asserts builds; NFC.
Aaron Ballman [Tue, 20 Jan 2015 17:10:45 +0000 (17:10 +0000)]
Silencing a -Wunused-variable warning in non-asserts builds; NFC.

llvm-svn: 226581

9 years agoFix use after free.
Rafael Espindola [Tue, 20 Jan 2015 17:08:27 +0000 (17:08 +0000)]
Fix use after free.

This fixes running a few tests (including test/elf/Mips/e-flags-merge-1.test)
under asan.

llvm-svn: 226580

9 years agoRevert "IR: Specify underlying type instead of r226570, NFC"
Duncan P. N. Exon Smith [Tue, 20 Jan 2015 17:04:56 +0000 (17:04 +0000)]
Revert "IR: Specify underlying type instead of r226570, NFC"

This reverts commit r226571.  GCC really doesn't like it [1].

[1]: http://bb.pgr.jp/builders/cmake-llvm-x86_64-linux/builds/20260

llvm-svn: 226579

9 years agoPatch fixes PR21932 crash on invalid code. Using
Fariborz Jahanian [Tue, 20 Jan 2015 16:53:34 +0000 (16:53 +0000)]
Patch fixes PR21932 crash on invalid code. Using
property-dot syntax on 'super' with no super
class. Patch by Jason Haslam.

llvm-svn: 226578

9 years ago[mips][microMIPS] MicroMIPS 16-bit unconditional branch instruction B
Jozef Kolek [Tue, 20 Jan 2015 16:45:27 +0000 (16:45 +0000)]
[mips][microMIPS] MicroMIPS 16-bit unconditional branch instruction B

Implement microMIPS 16-bit unconditional branch instruction B.

Implemented 16-bit microMIPS unconditional instruction has real name B16, and
B is an alias which expands to either B16 or BEQ according to the rules:
b 256 --> b16 256 # R_MICROMIPS_PC10_S1
b 12256 --> beq $zero, $zero, 12256 # R_MICROMIPS_PC16_S1
b label --> beq $zero, $zero, label # R_MICROMIPS_PC16_S1

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

llvm-svn: 226577

9 years agoPrint compiler path during configuration and pass more flags to the linker
Eric Fiselier [Tue, 20 Jan 2015 16:26:48 +0000 (16:26 +0000)]
Print compiler path during configuration and pass more flags to the linker

llvm-svn: 226576

9 years agoAddress danalbert's post-commit review comments on D7019 and small fixes.
Eric Fiselier [Tue, 20 Jan 2015 16:14:18 +0000 (16:14 +0000)]
Address danalbert's post-commit review comments on D7019 and small fixes.

This patch addresses some comments on http://reviews.llvm.org/D7019.

- Move compiler.py to test/libcxx from test/libcxx/test.
- Make CXXCompiler.target None by default.
- Use `{}` instead of `dict()` to initialize an empty dict.
- Pass the -fsanitize options to both the compile and link commands.

llvm-svn: 226575

9 years ago[mips] Add registers and ALL check prefix to octeon test case.
Kai Nacke [Tue, 20 Jan 2015 16:14:02 +0000 (16:14 +0000)]
[mips] Add registers and ALL check prefix to octeon test case.

No functional change.

Reviewed by D. Sanders

llvm-svn: 226574

9 years ago[mips] Add octeon branch instructions bbit0/bbit032/bbit1/bbit132
Kai Nacke [Tue, 20 Jan 2015 16:10:51 +0000 (16:10 +0000)]
[mips] Add octeon branch instructions bbit0/bbit032/bbit1/bbit132

This commits adds the octeon branch instructions bbit0/bbit032/bbit1/bbit132.
It also includes patterns for instruction selection and test cases.

Reviewed by D. Sanders

llvm-svn: 226573

9 years agoELF: Handle sh_addralign being set to zero
Will Newton [Tue, 20 Jan 2015 16:10:04 +0000 (16:10 +0000)]
ELF: Handle sh_addralign being set to zero

sh_addralign of zero is equivalent to sh_addralign of one, meaning
no alignment specified. Avoid calculating Log2 or modulus when
sh_addralign is zero as the results will not be useful.

llvm-svn: 226572

9 years agoIR: Specify underlying type instead of r226570, NFC
Duncan P. N. Exon Smith [Tue, 20 Jan 2015 16:03:09 +0000 (16:03 +0000)]
IR: Specify underlying type instead of r226570, NFC

llvm-svn: 226571

9 years agoIR: Store StorageType as an unsigned bitfield
Duncan P. N. Exon Smith [Tue, 20 Jan 2015 15:51:14 +0000 (15:51 +0000)]
IR: Store StorageType as an unsigned bitfield

Use `unsigned` instead of `StorageType` for the bitfield to prevent MSVC
from treating the top bit of the bitfield as a sign bit.

llvm-svn: 226570

9 years ago[msan] Optimize -msan-check-constant-shadow.
Evgeniy Stepanov [Tue, 20 Jan 2015 15:21:35 +0000 (15:21 +0000)]
[msan] Optimize -msan-check-constant-shadow.

The new code does not create new basic blocks in the case when shadow is a
compile-time constant; it generates either an unconditional __msan_warning
call or nothing instead.

llvm-svn: 226569

9 years agoFix help test cases after r226068
Ed Maste [Tue, 20 Jan 2015 15:13:01 +0000 (15:13 +0000)]
Fix help test cases after r226068

From: Ilia K <ki.stfu@gmail.com>
Differential Revision: http://reviews.llvm.org/D7066

llvm-svn: 226568

9 years ago[MIPS64] Make __clear_cache more optimal
Petar Jovanovic [Tue, 20 Jan 2015 15:04:19 +0000 (15:04 +0000)]
[MIPS64] Make __clear_cache more optimal

Use synci implementation of clear_cache for short address ranges.
For long address ranges, make a kernel call.

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

llvm-svn: 226567

9 years ago[asan] Allow changing verbosity in activation flags.
Evgeniy Stepanov [Tue, 20 Jan 2015 13:21:20 +0000 (13:21 +0000)]
[asan] Allow changing verbosity in activation flags.

This change removes some debug output in asan_flags.cc that
was reading the verbosity level before all the flags were parsed.

llvm-svn: 226566

9 years ago[MSan][LLVM][MIPS] Shadow and Origin offsets for MIPS
Mohit K. Bhakkad [Tue, 20 Jan 2015 13:05:42 +0000 (13:05 +0000)]
[MSan][LLVM][MIPS] Shadow and Origin offsets for MIPS

Reviewers: kcc, samsonov, petarj, eugenis

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

llvm-svn: 226565

9 years agoclang-format: Fix AlwaysBreakBeforeMultilineStrings with ColumnLimit=0
Daniel Jasper [Tue, 20 Jan 2015 12:59:20 +0000 (12:59 +0000)]
clang-format: Fix AlwaysBreakBeforeMultilineStrings with ColumnLimit=0

Before:
  const char *x =
      "hello llvm";

After:
  const char *x = "hello llvm";

This fixes llvm.org/PR22245.
Patch by Bill Meltsner, thank you!

llvm-svn: 226564

9 years ago[asan] Warn if unsupported flags are used at activation.
Evgeniy Stepanov [Tue, 20 Jan 2015 12:19:14 +0000 (12:19 +0000)]
[asan] Warn if unsupported flags are used at activation.

llvm-svn: 226563

9 years ago[x86] Add some mayLoad/hasSideEffects flags. Remove one that was already covered...
Craig Topper [Tue, 20 Jan 2015 12:15:30 +0000 (12:15 +0000)]
[x86] Add some mayLoad/hasSideEffects flags. Remove one that was already covered by a pattern.

llvm-svn: 226562

9 years agoRe-apply "r226548 - Introduce SPIR calling conventions" reverted in r226558.
Alexander Kornienko [Tue, 20 Jan 2015 11:20:41 +0000 (11:20 +0000)]
Re-apply "r226548 - Introduce SPIR calling conventions" reverted in r226558.

The test was fixed after a discussion with the revision author: the check
pattern was made more flexible as the "%call" part is not what we actually want
to check strictly there.

The original patch description:
===
Introduce SPIR calling conventions.

This implements Section 3.7 from the SPIR 1.2 spec:

    SPIR kernels should use "spir_kernel" calling convention.
    Non-kernel functions use "spir_func" calling convention. All
    other calling conventions are disallowed.

The patch works only for OpenCL source. Any other uses will need
to ensure that kernels are assigned the spir_kernel calling
convention correctly.
===

llvm-svn: 226561

9 years ago[PM] Port LoopInfo to the new pass manager, adding both a LoopAnalysis
Chandler Carruth [Tue, 20 Jan 2015 10:58:50 +0000 (10:58 +0000)]
[PM] Port LoopInfo to the new pass manager, adding both a LoopAnalysis
pass and a LoopPrinterPass with the expected associated wiring.

I've added a RUN line to the only test case (!!!) we have that actually
prints loops. Everything seems to be working.

This is somewhat exciting as this is the first analysis using another
analysis to go in for the new pass manager. =D I also believe it is the
last analysis necessary for porting instcombine, but of course I may yet
discover more.

llvm-svn: 226560

9 years ago[PM] Make the LoopInfoBase and LoopInfo objects movable so that they can
Chandler Carruth [Tue, 20 Jan 2015 10:58:38 +0000 (10:58 +0000)]
[PM] Make the LoopInfoBase and LoopInfo objects movable so that they can
be used as results in the new pass manager.

llvm-svn: 226559

9 years agoReverting r226548 as one of the tests fails in some configurations.
Alexander Kornienko [Tue, 20 Jan 2015 10:55:33 +0000 (10:55 +0000)]
Reverting r226548 as one of the tests fails in some configurations.

Here's the fail log from our internal setup:
===
  .../tools/clang/clang -cc1 -internal-isystem .../tools/clang/staging/include -nostdsysteminc .../tools/clang/test/CodeGenOpenCL/spir-calling-conv.cl -triple spir-unknown-unknown -emit-llvm -o -
  FileCheck .../tools/clang/test/CodeGenOpenCL/spir-calling-conv.cl
.../tools/clang/test/CodeGenOpenCL/spir-calling-conv.cl:11:12: error: expected string not found in input
 // CHECK: %call = tail call spir_func i32 @get_dummy_id(i32 0)
           ^
<stdin>:6:52: note: scanning from here
define spir_kernel void @foo(i32 addrspace(1)* %A) #0 {
                                                   ^
<stdin>:7:2: note: possible intended match here
 %1 = tail call spir_func i32 @get_dummy_id(i32 0) #2
 ^
===

Here's a failure on a public CI server:
http://lab.llvm.org:8080/green/job/clang-stage2-configure-Rlto_check/1183/

llvm-svn: 226558

9 years agoELF: Support detection of relocation errors during processing
Will Newton [Tue, 20 Jan 2015 10:37:40 +0000 (10:37 +0000)]
ELF: Support detection of relocation errors during processing

At the moment errors in relocation processing such as out of range
values are not detected or at best trapped by asserts which will not
be present in release builds. This patch adds support for checking
error return values from applyRelocation() calls and printing an
appropriate error message. It also adds support for printing multiple
errors rather than just the first one.

llvm-svn: 226557

9 years ago[PM] Fix a moderately scary typo in the deleted copy constructor
Chandler Carruth [Tue, 20 Jan 2015 10:20:52 +0000 (10:20 +0000)]
[PM] Fix a moderately scary typo in the deleted copy constructor
I noticed when adding move semantics to LoopInfo.

Hopefully not relevant, but still scary. =]

llvm-svn: 226556

9 years ago[PM] Use range-based for and auto to clean up some of the LoopInfo code.
Chandler Carruth [Tue, 20 Jan 2015 10:02:49 +0000 (10:02 +0000)]
[PM] Use range-based for and auto to clean up some of the LoopInfo code.

No functionality changed.

llvm-svn: 226555

9 years ago[Msan] Fix the readlink unit test to pass on FreeBSD
Viktor Kutuzov [Tue, 20 Jan 2015 09:57:28 +0000 (09:57 +0000)]
[Msan] Fix the readlink unit test to pass on FreeBSD
Differential Revision: http://reviews.llvm.org/D7052

llvm-svn: 226554

9 years ago[clang-tidy] Make ClangTidyOptionsProvider::getOptions return by value.
Alexander Kornienko [Tue, 20 Jan 2015 09:48:51 +0000 (09:48 +0000)]
[clang-tidy] Make ClangTidyOptionsProvider::getOptions return by value.

Returning by reference limits possible implementations and doesn't bring any
benefits as all callers make copies of the returned value anyway.

llvm-svn: 226553

9 years agoTest commit, no changes.
Pavel Labath [Tue, 20 Jan 2015 09:47:57 +0000 (09:47 +0000)]
Test commit, no changes.

llvm-svn: 226552

9 years agoFactor out a splitSwitchCase() function so that it can be reused.
Daniel Jasper [Tue, 20 Jan 2015 08:57:44 +0000 (08:57 +0000)]
Factor out a splitSwitchCase() function so that it can be reused.

This is in preparation for a fix to llvm.org/PR22262. One of the ideas
here is to first find a good jump table range first and then split
before and after it. Thereby, we don't need to use the
split-based-on-density heuristic at all, which can make the "binary
tree" deteriorate in various cases.

Also some minor cleanups.

No functional changes.

llvm-svn: 226551

9 years ago[PM] Move the LoopInfo analysis pointer into the InstCombiner class
Chandler Carruth [Tue, 20 Jan 2015 08:35:24 +0000 (08:35 +0000)]
[PM] Move the LoopInfo analysis pointer into the InstCombiner class
along with the other analyses.

The most obvious reason why is because eventually I need to separate out
the pass layer from the rest of the instcombiner. However, it is also
probably a compile time win as every query through the pass manager
layer is pretty slow these days.

llvm-svn: 226550

9 years ago[OPENMP] Fixed DSA processing for predetermined shared variables.
Alexey Bataev [Tue, 20 Jan 2015 07:03:46 +0000 (07:03 +0000)]
[OPENMP] Fixed DSA processing for predetermined shared variables.
This patch allows to use predetermined shared variables in private clauses in
parallel or tasks regions.

llvm-svn: 226549

9 years agoIntroduce SPIR calling conventions.
Sameer Sahasrabuddhe [Tue, 20 Jan 2015 06:44:32 +0000 (06:44 +0000)]
Introduce SPIR calling conventions.

This implements Section 3.7 from the SPIR 1.2 spec:

    SPIR kernels should use "spir_kernel" calling convention.
    Non-kernel functions use "spir_func" calling convention. All
    other calling conventions are disallowed.

The patch works only for OpenCL source. Any other uses will need
to ensure that kernels are assigned the spir_kernel calling
convention correctly.

llvm-svn: 226548

9 years agoFix Operandreorder logic in SLPVectorizer to generate longer vectorizable chain.
Karthik Bhat [Tue, 20 Jan 2015 06:11:00 +0000 (06:11 +0000)]
Fix Operandreorder logic in SLPVectorizer to generate longer vectorizable chain.
This patch fixes 2 issues in reorderInputsAccordingToOpcode
1) AllSameOpcodeLeft and AllSameOpcodeRight was being calculated incorrectly resulting in code not being vectorized in few cases.
2) Adds logic to reorder operands if we get longer chain of consecutive loads enabling vectorization. Handled the same for cases were we have AltOpcode.
Thanks Michael for inputs and review.
Review: http://reviews.llvm.org/D6677

llvm-svn: 226547

9 years agoBitcode: Don't create comdats when autoupgrading macho bitcode
David Majnemer [Tue, 20 Jan 2015 05:58:07 +0000 (05:58 +0000)]
Bitcode: Don't create comdats when autoupgrading macho bitcode

Don't infer COMDAT groups from older bitcode if the target is macho,
it doesn't have COMDATs.

llvm-svn: 226546

9 years agoReapply "IR: Simplify DIBuilder's HeaderBuilder API, NFC"
Duncan P. N. Exon Smith [Tue, 20 Jan 2015 05:02:42 +0000 (05:02 +0000)]
Reapply "IR: Simplify DIBuilder's HeaderBuilder API, NFC"

This reverts commit r226542, effectively reapplying r226540.  This time,
initialize `IsEmpty` in the copy and move constructors as well.

llvm-svn: 226545

9 years agoFix creation of StringRef in FileSpec::ResolveUsername()
Jason Molenda [Tue, 20 Jan 2015 04:20:42 +0000 (04:20 +0000)]
Fix creation of StringRef in FileSpec::ResolveUsername()
so it doesn't assume that the SmallVector<char> will have
nul terminator.  It did not in at least one case.
Caught by ASAN instrumentation.

llvm-svn: 226544

9 years agoDon't mention a "--core-file" argument to target create. It is
Jason Molenda [Tue, 20 Jan 2015 03:06:17 +0000 (03:06 +0000)]
Don't mention a "--core-file" argument to target create.  It is
"--core".

<rdar://problem/19518164>

llvm-svn: 226543

9 years agoRevert "IR: Simplify DIBuilder's HeaderBuilder API, NFC"
Duncan P. N. Exon Smith [Tue, 20 Jan 2015 03:01:27 +0000 (03:01 +0000)]
Revert "IR: Simplify DIBuilder's HeaderBuilder API, NFC"

This reverts commit r226540, since I hit an unexpected bot failure [1].
I'll investigate.

[1]: http://bb.pgr.jp/builders/cmake-llvm-x86_64-linux/builds/20244

llvm-svn: 226542

9 years agoIR: Move MDNode clone() methods from ValueMapper to MDNode, NFC
Duncan P. N. Exon Smith [Tue, 20 Jan 2015 02:56:57 +0000 (02:56 +0000)]
IR: Move MDNode clone() methods from ValueMapper to MDNode, NFC

Now that the clone methods used by `MapMetadata()` don't do any
remapping (and return a temporary), they make more sense as member
functions on `MDNode` (and subclasses).

llvm-svn: 226541

9 years agoIR: Simplify DIBuilder's HeaderBuilder API, NFC
Duncan P. N. Exon Smith [Tue, 20 Jan 2015 02:54:07 +0000 (02:54 +0000)]
IR: Simplify DIBuilder's HeaderBuilder API, NFC

Change `HeaderBuilder` API to work well even when it's not starting with
a tag.  There's already one case like this, and the tag is moving
elsewhere as part of PR22235.

llvm-svn: 226540

9 years agoAsmParser: PARSE_MD_FIELD() => ParseMDField(), NFC
Duncan P. N. Exon Smith [Tue, 20 Jan 2015 02:42:29 +0000 (02:42 +0000)]
AsmParser: PARSE_MD_FIELD() => ParseMDField(), NFC

Extract most of `PARSE_MD_FIELD()` into a function.

llvm-svn: 226539

9 years agoAsmParser: Refactor duplicate code, NFC
Duncan P. N. Exon Smith [Tue, 20 Jan 2015 02:39:21 +0000 (02:39 +0000)]
AsmParser: Refactor duplicate code, NFC

llvm-svn: 226538

9 years ago[PM] Replace the Pass argument in MergeBasicBlockIntoOnlyPred with
Chandler Carruth [Tue, 20 Jan 2015 01:37:09 +0000 (01:37 +0000)]
[PM] Replace the Pass argument in MergeBasicBlockIntoOnlyPred with
a DominatorTree argument as that is the analysis that it wants to
update.

This removes the last non-loop utility function in Utils/ which accepts
a raw Pass argument.

llvm-svn: 226537

9 years agoIR: Delete GenericDwarfNode during teardown
Duncan P. N. Exon Smith [Tue, 20 Jan 2015 01:18:32 +0000 (01:18 +0000)]
IR: Delete GenericDwarfNode during teardown

Fix a leak in `LLVMContextImpl` teardown that the leak sanitizer tracked
down [1].  I've just switched to automatic dispatch here (since I'll
inevitably forget again with the next class).

[1]: http://lab.llvm.org:8011/builders/sanitizer-x86_64-linux-fast/builds/811/steps/check-llvm%20asan/logs/stdio

llvm-svn: 226536

9 years agoBitcode: Simplify MDNode subclass dispatch, NFC
Duncan P. N. Exon Smith [Tue, 20 Jan 2015 01:03:09 +0000 (01:03 +0000)]
Bitcode: Simplify MDNode subclass dispatch, NFC

llvm-svn: 226535

9 years agoBitcode: WriteMDNode() => WriteMDTuple(), NFC
Duncan P. N. Exon Smith [Tue, 20 Jan 2015 01:01:53 +0000 (01:01 +0000)]
Bitcode: WriteMDNode() => WriteMDTuple(), NFC

llvm-svn: 226534

9 years agoBitcode: Add ValueEnumerator::getMetadataOrNullID(), NFC
Duncan P. N. Exon Smith [Tue, 20 Jan 2015 01:00:23 +0000 (01:00 +0000)]
Bitcode: Add ValueEnumerator::getMetadataOrNullID(), NFC

llvm-svn: 226533

9 years agoIR: Canonicalize GenericDwarfNode empty headers to null
Duncan P. N. Exon Smith [Tue, 20 Jan 2015 00:58:46 +0000 (00:58 +0000)]
IR: Canonicalize GenericDwarfNode empty headers to null

llvm-svn: 226532

9 years agoIR: Detect whether to call recalculateHash() via SFINAE, NFC
Duncan P. N. Exon Smith [Tue, 20 Jan 2015 00:57:33 +0000 (00:57 +0000)]
IR: Detect whether to call recalculateHash() via SFINAE, NFC

Rather than relying on updating switch statements correctly, detect
whether `setHash()` exists in the subclass.  If so, call
`recalculateHash()` and `setHash(0)` appropriately.

llvm-svn: 226531

9 years agoAdded an Xcode target so we build the "lldb-mi" executable as part of the "desktop...
Greg Clayton [Tue, 20 Jan 2015 00:04:26 +0000 (00:04 +0000)]
Added an Xcode target so we build the "lldb-mi" executable as part of the "desktop" and "desktop no xpc" targets.

Include paths were switched to be user include paths, if this breaks the linux build we will need to fix the Makefiles/cmake stuff.

<rdar://problem/19198581>

llvm-svn: 226530

9 years agoIR: Introduce GenericDwarfNode
Duncan P. N. Exon Smith [Tue, 20 Jan 2015 00:01:43 +0000 (00:01 +0000)]
IR: Introduce GenericDwarfNode

As part of PR22235, introduce `DwarfNode` and `GenericDwarfNode`.  The
former is a metadata node with a DWARF tag.  The latter matches our
current (generic) schema of a header with string (and stringified
integer) data and an arbitrary number of operands.

This doesn't move it into place yet; that change will require a large
number of testcase updates.

llvm-svn: 226529

9 years agoFix a race condition where you could set the selected thread & target in the
Jim Ingham [Mon, 19 Jan 2015 23:51:51 +0000 (23:51 +0000)]
Fix a race condition where you could set the selected thread & target in the
CommandInterpreter's execution context AFTER the process had started running
and before it initially stopped.  Also fixed one test case that was implicitly
using this (and an abuse of the async mode) to accidentally succeed.

<rdar://problem/16814726>

llvm-svn: 226528

9 years agoAsmParser: Abstract more of MDLocation parser, NFC
Duncan P. N. Exon Smith [Mon, 19 Jan 2015 23:44:41 +0000 (23:44 +0000)]
AsmParser: Abstract more of MDLocation parser, NFC

llvm-svn: 226527

9 years agoAsmParser: Split up ParseMDFieldsImpl(), NFC
Duncan P. N. Exon Smith [Mon, 19 Jan 2015 23:39:32 +0000 (23:39 +0000)]
AsmParser: Split up ParseMDFieldsImpl(), NFC

llvm-svn: 226526

9 years ago[dsymutil] Add the detected target triple to the debug map.
Frederic Riss [Mon, 19 Jan 2015 23:33:14 +0000 (23:33 +0000)]
[dsymutil] Add the detected target triple to the debug map.

It will be needed to instantiate the Target object that we will
use to create all the MC objects for the dwarf emission.

llvm-svn: 226525

9 years agoAsmParser: Fix error location for missing fields
Duncan P. N. Exon Smith [Mon, 19 Jan 2015 23:32:36 +0000 (23:32 +0000)]
AsmParser: Fix error location for missing fields

llvm-svn: 226524

9 years agoIR: Cleanup MDNode field use, NFC
Duncan P. N. Exon Smith [Mon, 19 Jan 2015 23:18:34 +0000 (23:18 +0000)]
IR: Cleanup MDNode field use, NFC

Swap usage of `SubclassData32` and `MDNodeSubclassData`, and rename
`MDNodeSubclassData` to `NumUnresolved`.  Small drive-by cleanup to
`countUnresolvedOperands()` since otherwise the name clash with local
vars named `NumUnresolved` would be confusing.

llvm-svn: 226523

9 years agoIR: Move replaceWithUniqued(), etc., to source file, NFC
Duncan P. N. Exon Smith [Mon, 19 Jan 2015 23:17:09 +0000 (23:17 +0000)]
IR: Move replaceWithUniqued(), etc., to source file, NFC

llvm-svn: 226522

9 years agoIR: Cleanup MDNode::MDNode(), NFC
Duncan P. N. Exon Smith [Mon, 19 Jan 2015 23:15:21 +0000 (23:15 +0000)]
IR: Cleanup MDNode::MDNode(), NFC

llvm-svn: 226521

9 years agoIR: Merge UniquableMDNode back into MDNode, NFC
Duncan P. N. Exon Smith [Mon, 19 Jan 2015 23:13:14 +0000 (23:13 +0000)]
IR: Merge UniquableMDNode back into MDNode, NFC

As pointed out in r226501, the distinction between `MDNode` and
`UniquableMDNode` is confusing.  When we need subclasses of `MDNode`
that don't use all its functionality it might make sense to break it
apart again, but until then this makes the code clearer.

llvm-svn: 226520

9 years agoIR: Extract MDNodeOpsKey, NFC
Duncan P. N. Exon Smith [Mon, 19 Jan 2015 22:53:18 +0000 (22:53 +0000)]
IR: Extract MDNodeOpsKey, NFC

Make the MDTuple operand hashing logic reusable.

llvm-svn: 226519

9 years agoIR: Simplify uniquifyImpl(), NFC
Duncan P. N. Exon Smith [Mon, 19 Jan 2015 22:52:07 +0000 (22:52 +0000)]
IR: Simplify uniquifyImpl(), NFC

llvm-svn: 226518

9 years agoIR: Simplify erasing from uniquing store, NFC
Duncan P. N. Exon Smith [Mon, 19 Jan 2015 22:47:08 +0000 (22:47 +0000)]
IR: Simplify erasing from uniquing store, NFC

llvm-svn: 226517

9 years agoRemove dead code, NFC
Duncan P. N. Exon Smith [Mon, 19 Jan 2015 22:45:41 +0000 (22:45 +0000)]
Remove dead code, NFC

llvm-svn: 226516

9 years agoUtils: Simplify MapMetadata(), NFC
Duncan P. N. Exon Smith [Mon, 19 Jan 2015 22:44:32 +0000 (22:44 +0000)]
Utils: Simplify MapMetadata(), NFC

Extract out the operand remapping loops, which are now very similar.

llvm-svn: 226515

9 years agoSkip upcast, NFC
Duncan P. N. Exon Smith [Mon, 19 Jan 2015 22:41:14 +0000 (22:41 +0000)]
Skip upcast, NFC

llvm-svn: 226514

9 years ago[X86][AVX] Missing AVX1 memory folding float instructions
Simon Pilgrim [Mon, 19 Jan 2015 22:40:45 +0000 (22:40 +0000)]
[X86][AVX] Missing AVX1 memory folding float instructions

Now that we can create much more exhaustive X86 memory folding tests, this patch adds the missing AVX1/F16C floating point instruction stack foldings we can easily test for including the scalar intrinsics (add, div, max, min, mul, sub), conversions float/int to double, half precision conversions, rounding, dot product and bit test. The patch also adds a couple of obviously missing SSE instructions (more to follow once we have full SSE testing).

Now that scalar folding is working it broke a very old test (2006-10-07-ScalarSSEMiscompile.ll) - this test appears to make no sense as its trying to ensure that a scalar subtraction isn't folded as it 'would zero the top elts of the loaded vector' - this test just appears to be wrong to me.

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

llvm-svn: 226513

9 years agoFix whitespace, NFC
Duncan P. N. Exon Smith [Mon, 19 Jan 2015 22:40:25 +0000 (22:40 +0000)]
Fix whitespace, NFC

llvm-svn: 226512

9 years agoUtils: Simplify MapMetadata(), NFC
Duncan P. N. Exon Smith [Mon, 19 Jan 2015 22:39:07 +0000 (22:39 +0000)]
Utils: Simplify MapMetadata(), NFC

Take advantage of the new ability of temporary nodes to mutate to
distinct and uniqued nodes to greatly simplify the `MapMetadata()`
helper functions.

llvm-svn: 226511

9 years agoIR: Allow temporary nodes to become uniqued or distinct
Duncan P. N. Exon Smith [Mon, 19 Jan 2015 22:24:52 +0000 (22:24 +0000)]
IR: Allow temporary nodes to become uniqued or distinct

Add `MDNode::replaceWithUniqued()` and `MDNode::replaceWithDistinct()`,
which mutate temporary nodes to become uniqued or distinct.  On uniquing
collisions, the unique version is returned and the node is deleted.

This takes advantage of temporary nodes being folded back in, and should
let me clean up some awkward logic in `MapMetadata()`.

llvm-svn: 226510

9 years agoIR: Remove templates from TempMDNodeDeleter, NFC
Duncan P. N. Exon Smith [Mon, 19 Jan 2015 22:21:15 +0000 (22:21 +0000)]
IR: Remove templates from TempMDNodeDeleter, NFC

r226504 added `TempMDNodeDeleter` to help with `std::unique_ptr<>`-izing
the `MDNode::getTemporary()` interface.  It doesn't need to be
templated, though.

llvm-svn: 226509

9 years agoIR: Split out countUnresolvedOperands(), NFC
Duncan P. N. Exon Smith [Mon, 19 Jan 2015 22:18:29 +0000 (22:18 +0000)]
IR: Split out countUnresolvedOperands(), NFC

llvm-svn: 226508

9 years agoCleanup whitespace, NFC
Duncan P. N. Exon Smith [Mon, 19 Jan 2015 22:16:01 +0000 (22:16 +0000)]
Cleanup whitespace, NFC

llvm-svn: 226507

9 years agoCodeGen: Update IRBuilder for LLVM API change
Duncan P. N. Exon Smith [Mon, 19 Jan 2015 21:31:48 +0000 (21:31 +0000)]
CodeGen: Update IRBuilder for LLVM API change

`MDNode::getTemporary()` returns a `unique_ptr<>` as of r226504.

llvm-svn: 226506

9 years agoCodeGen: Update LoopAttributes for LLVM API change
Duncan P. N. Exon Smith [Mon, 19 Jan 2015 21:30:48 +0000 (21:30 +0000)]
CodeGen: Update LoopAttributes for LLVM API change

`MDNode::getTemporary()` returns a `unique_ptr<>` as of r226504.

llvm-svn: 226505

9 years agoIR: Return unique_ptr from MDNode::getTemporary()
Duncan P. N. Exon Smith [Mon, 19 Jan 2015 21:30:18 +0000 (21:30 +0000)]
IR: Return unique_ptr from MDNode::getTemporary()

Change `MDTuple::getTemporary()` and `MDLocation::getTemporary()` to
return (effectively) `std::unique_ptr<T, MDNode::deleteTemporary>`, and
clean up call sites.  (For now, `DIBuilder` call sites just call
`release()` immediately.)

There's an accompanying change in each of clang and polly to use the new
API.

llvm-svn: 226504

9 years agoAdd r224985 back with fixes.
Rafael Espindola [Mon, 19 Jan 2015 21:11:14 +0000 (21:11 +0000)]
Add r224985 back with fixes.

The fixes are to note that AArch64 has additional restrictions on when local
relocations can be used. In particular, ld64 requires that relocations to
cstring/cfstrings use linker visible symbols.

Original message:

In an assembly expression like

bar:
  .long L0 + 1

the intended semantics is that bar will contain a pointer one byte past L0.

In sections that are merged by content (strings, 4 byte constants, etc), a
single position in the section doesn't give the linker enough information.
For example, it would not be able to tell a relocation must point to the
end of a string, since that would look just like the start of the next.

The solution used in ELF to use relocation with symbols if there is a non-zero
addend.

In MachO before this patch we would just keep all symbols in some sections.

This would miss some cases (only cstrings on x86_64 were implemented) and was
inefficient since most relocations have an addend of 0 and can be represented
without the symbol.

This patch implements the non-zero addend logic for MachO too.

llvm-svn: 226503