platform/upstream/llvm.git
9 years agoMemoryDependenceAnalysis: Don't miscompile atomics
David Majnemer [Sat, 21 Mar 2015 06:19:17 +0000 (06:19 +0000)]
MemoryDependenceAnalysis: Don't miscompile atomics

r216771 introduced a change to MemoryDependenceAnalysis that allowed it
to reason about acquire/release operations.  However, this change does
not ensure that the acquire/release operations pair.  Unfortunately,
this leads to miscompiles as we won't see an acquire load as properly
memory effecting.  This largely reverts r216771.

This fixes PR22708.

llvm-svn: 232889

9 years agoAdd CodeGen support for adding cpu attributes on functions based on
Eric Christopher [Sat, 21 Mar 2015 06:15:15 +0000 (06:15 +0000)]
Add CodeGen support for adding cpu attributes on functions based on
the target-cpu, if different from the triple's cpu, and
target-features as they're written that are passed down from the
driver.

Together with LLVM r232885 this should allow the LTO'ing of binaries
that contain modules compiled with different code generation options
on a subset of architectures with full backend support (x86, powerpc,
aarch64).

llvm-svn: 232888

9 years agoRemove unneeded redeclaration of reference_wrapper.
Eric Fiselier [Sat, 21 Mar 2015 06:05:45 +0000 (06:05 +0000)]
Remove unneeded redeclaration of reference_wrapper.

llvm-svn: 232887

9 years agoAArch64: simplify test case
Tim Northover [Sat, 21 Mar 2015 04:37:08 +0000 (04:37 +0000)]
AArch64: simplify test case

llvm-svn: 232886

9 years agoRemove the target independent TargetMachine::getSubtarget and
Eric Christopher [Sat, 21 Mar 2015 04:22:23 +0000 (04:22 +0000)]
Remove the target independent TargetMachine::getSubtarget and
TargetMachine::getSubtargetImpl routines.

This keeps the target independent code free of bare subtarget
calls while the remainder of the backends are migrated, or not
if they don't wish to support per-function subtargets as would
be needed for function multiversioning or LTO of disparate
cpu subarchitecture types, e.g.

clang -msse4.2 -c foo.c -emit-llvm -o foo.bc
clang -c bar.c -emit-llvm -o bar.bc
llvm-link foo.bc bar.bc -o baz.bc
llc baz.bc

and get appropriate code for what the command lines requested.

llvm-svn: 232885

9 years agoRemove the bare getSubtargetImpl call from the AArch64 port. As part
Eric Christopher [Sat, 21 Mar 2015 04:04:50 +0000 (04:04 +0000)]
Remove the bare getSubtargetImpl call from the AArch64 port. As part
of this add a test that shows we can generate code for functions
that specifically enable a subtarget feature.

llvm-svn: 232884

9 years agoFix ComputeSupportExeDirectory for Linux (merge with Android).
Chaoren Lin [Sat, 21 Mar 2015 03:59:29 +0000 (03:59 +0000)]
Fix ComputeSupportExeDirectory for Linux (merge with Android).

Summary:
ComputeSupportExeDirectory relied on ComputeSharedLibraryDirectory which was
not always reliable. Using procfs seems to be the best way to deal with it on
Linux (since it's already done on Android, might as well merge it).

Reviewers: ovyalov

Reviewed By: ovyalov

Subscribers: lldb-commits

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

llvm-svn: 232883

9 years agoRemove the bare getSubtargetImpl call from the PPC port. As part
Eric Christopher [Sat, 21 Mar 2015 03:36:02 +0000 (03:36 +0000)]
Remove the bare getSubtargetImpl call from the PPC port. As part
of this add a test that shows we can generate code with
for functions that differ by subtarget feature.

llvm-svn: 232882

9 years agoForward the Function based getSubtarget call to the appropriate Impl
Eric Christopher [Sat, 21 Mar 2015 03:32:45 +0000 (03:32 +0000)]
Forward the Function based getSubtarget call to the appropriate Impl
call.

llvm-svn: 232881

9 years agoGrab a subtarget off of an AMDGPUTargetMachine rather than a
Eric Christopher [Sat, 21 Mar 2015 03:17:25 +0000 (03:17 +0000)]
Grab a subtarget off of an AMDGPUTargetMachine rather than a
bare target machine in preparation for the TargetMachine bare
getSubtarget/getSubtargetImpl calls going away.

llvm-svn: 232880

9 years agoCache the Function dependent subtarget on the MachineFunction.
Eric Christopher [Sat, 21 Mar 2015 03:13:10 +0000 (03:13 +0000)]
Cache the Function dependent subtarget on the MachineFunction.

As preparation for removing the getSubtargetImpl() call from
TargetMachine go ahead and flip the switch on caching the function
dependent subtarget and remove the bare getSubtargetImpl call
from the X86 port. As part of this add a few tests that show we
can generate code and assemble on X86 based on features/cpu on
the Function.

llvm-svn: 232879

9 years agoGrab the cached subtarget off of the MachineFunction.
Eric Christopher [Sat, 21 Mar 2015 03:13:07 +0000 (03:13 +0000)]
Grab the cached subtarget off of the MachineFunction.

llvm-svn: 232878

9 years agoGrab a subtarget off of a MipsTargetMachine rather than a
Eric Christopher [Sat, 21 Mar 2015 03:13:05 +0000 (03:13 +0000)]
Grab a subtarget off of a MipsTargetMachine rather than a
bare target machine in preparation for the TargetMachine bare
getSubtarget/getSubtargetImpl calls going away.

llvm-svn: 232877

9 years agoSimplify the query for a subtarget in the NVPTX pass manager.
Eric Christopher [Sat, 21 Mar 2015 03:13:03 +0000 (03:13 +0000)]
Simplify the query for a subtarget in the NVPTX pass manager.

llvm-svn: 232876

9 years agoChange getISAEncoding to use the target triple to determine
Eric Christopher [Sat, 21 Mar 2015 03:13:01 +0000 (03:13 +0000)]
Change getISAEncoding to use the target triple to determine
thumb-ness similar to the rest of the Module level asm printing
infrastructure as debug info finalization happens after the function
may be missing.

llvm-svn: 232875

9 years agoMake the Hexagon ISelDAGToDAG pass set the subtarget dynamically
Eric Christopher [Sat, 21 Mar 2015 03:12:59 +0000 (03:12 +0000)]
Make the Hexagon ISelDAGToDAG pass set the subtarget dynamically
on each runOnMachineFunction invocation.

llvm-svn: 232874

9 years ago[sanitizer] experimental tracing for cmp instructions
Kostya Serebryany [Sat, 21 Mar 2015 01:29:36 +0000 (01:29 +0000)]
[sanitizer] experimental tracing for cmp instructions

llvm-svn: 232873

9 years ago[CodeGen][IfCvt] Don't re-ifcvt blocks with unanalyzable terminators.
Ahmed Bougacha [Sat, 21 Mar 2015 01:23:15 +0000 (01:23 +0000)]
[CodeGen][IfCvt] Don't re-ifcvt blocks with unanalyzable terminators.

If we couldn't analyze its terminator (i.e., it's an indirectbr, or some
other weirdness), we can't safely re-if-convert a predicated block,
because we can't tell whether the predicated terminator can
fallthrough (it does).

Currently, we would completely ignore the fallthrough successor. In
the added testcase, this means we used to generate:

    ...
  @ %entry:
    cmp   r5, #21
    ittt  ne
  @ %cc1f:
    cmpne r7, #42
  @ %cc2t:
    strne.w       r5, [r8]
    movne pc, r10
  @ %cc1t:
    ...

Whereas the successor of %cc1f was originally %bb1.
With the fix, we get the correct:

    ...
  @ %entry:
    cmp   r5, #21
    itt   eq
  @ %cc1t:
    streq.w       r5, [r11]
    moveq pc, r0
  @ %cc1f:
    cmp   r7, #42
    itt   ne
  @ %cc2t:
    strne.w       r5, [r8]
    movne pc, r10
  @ %bb1:
    ...

rdar://20192768
Differential Revision: http://reviews.llvm.org/D8509

llvm-svn: 232872

9 years ago[AArch64] Prefer UZP for concat_vector of illegal truncs.
Ahmed Bougacha [Sat, 21 Mar 2015 01:08:39 +0000 (01:08 +0000)]
[AArch64] Prefer UZP for concat_vector of illegal truncs.

Follow-up to r232459: prefer a UZP shuffle to the intermediate truncs.

llvm-svn: 232871

9 years ago[modules] When either redecl chain merging or an update record causes us to
Richard Smith [Sat, 21 Mar 2015 00:58:54 +0000 (00:58 +0000)]
[modules] When either redecl chain merging or an update record causes us to
give an exception specification to a declaration that didn't have an exception
specification in any of our imported modules, emit an update record ourselves.
Without this, code importing the current module would not see an exception
specification that we could see and might have relied on.

llvm-svn: 232870

9 years agoOnly add -fno-rtti if KernelOrKext or in C++ mode.
Filipe Cabecinhas [Fri, 20 Mar 2015 23:51:15 +0000 (23:51 +0000)]
Only add -fno-rtti if KernelOrKext or in C++ mode.

llvm-svn: 232869

9 years ago[ELF] GLOBAL_OFFSET_TABLE is a hidden symbol
Shankar Easwaran [Fri, 20 Mar 2015 23:47:08 +0000 (23:47 +0000)]
[ELF] GLOBAL_OFFSET_TABLE is a hidden symbol

llvm-svn: 232868

9 years ago[ELF] Dont add local symbols for dynamic lookup.
Shankar Easwaran [Fri, 20 Mar 2015 23:47:05 +0000 (23:47 +0000)]
[ELF] Dont add local symbols for dynamic lookup.

Unable to add a unit test for this, as there is only one local undefined
symbol in regular shared libraries without a name.

llvm-svn: 232867

9 years ago[ELF] OrderPass : Order atoms only by ordinals.
Shankar Easwaran [Fri, 20 Mar 2015 23:47:03 +0000 (23:47 +0000)]
[ELF] OrderPass : Order atoms only by ordinals.

Move the init array/fini array sorting to the Output ELF writer.

AFAIK, this is only needed by the X86_64/ARM ABI.

This shaves time taken to self host lld by 0.2 seconds.

Before patch
----------------
4791.062059 task-clock                #    1.634 CPUs utilized            ( +-  0.28% )
     61,107 context-switches          #    0.013 M/sec                    ( +-  0.56% )
2.932902671 seconds time elapsed                                          ( +-  0.84% )

After patch
-------------
4608.417248 task-clock                #    1.669 CPUs utilized            ( +-  0.30% )
     61,616 context-switches          #    0.013 M/sec                    ( +-  0.63% )
2.761012703 seconds time elapsed                                          ( +-  0.63% )

llvm-svn: 232866

9 years ago[ELF][X86_64] Use anonymous namespace only for class declarations
Shankar Easwaran [Fri, 20 Mar 2015 23:47:01 +0000 (23:47 +0000)]
[ELF][X86_64] Use anonymous namespace only for class declarations

llvm-svn: 232865

9 years ago[ELF] Use unordered_map for AdditionalSegments
Shankar Easwaran [Fri, 20 Mar 2015 23:47:00 +0000 (23:47 +0000)]
[ELF] Use unordered_map for AdditionalSegments

Fix a leftover class during implementation.

llvm-svn: 232864

9 years ago[ELF] Use MapVector.
Shankar Easwaran [Fri, 20 Mar 2015 23:46:58 +0000 (23:46 +0000)]
[ELF] Use MapVector.

Order is still deterministic and we dont need a sorted order.

llvm-svn: 232863

9 years ago[ELF][X86_64] Remove relative references to include files
Shankar Easwaran [Fri, 20 Mar 2015 23:46:56 +0000 (23:46 +0000)]
[ELF][X86_64] Remove relative references to include files

llvm-svn: 232862

9 years ago[ELF][X86_64] Sort includes
Shankar Easwaran [Fri, 20 Mar 2015 23:46:54 +0000 (23:46 +0000)]
[ELF][X86_64] Sort includes

llvm-svn: 232861

9 years agoDon't claim exception related arguments when looking at RTTIMode
Filipe Cabecinhas [Fri, 20 Mar 2015 23:33:23 +0000 (23:33 +0000)]
Don't claim exception related arguments when looking at RTTIMode

Summary:
We were claiming the -f*exceptions arguments when looking for the
RTTIMode. This makes us not warn about unused arguments if compiling a C
file with -fcxx-exceptions.

This patch fixes it by not claiming the exception-related arguments at
that point.

Reviewers: rsmith, samsonov

Subscribers: cfe-commits

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

llvm-svn: 232860

9 years agoMake getLastArgNoClaim work for up to 4 arguments.
Filipe Cabecinhas [Fri, 20 Mar 2015 23:32:58 +0000 (23:32 +0000)]
Make getLastArgNoClaim work for up to 4 arguments.

Summary:
This is needed for http://reviews.llvm.org/D8507
I have no idea what stand-alone tests could be done, if needed.

Reviewers: Bigcheese, craig.topper, samsonov

Subscribers: llvm-commits

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

llvm-svn: 232859

9 years agoImprove automatic detection of filetype for sym_check
Eric Fiselier [Fri, 20 Mar 2015 23:07:38 +0000 (23:07 +0000)]
Improve automatic detection of filetype for sym_check

llvm-svn: 232858

9 years agofixed vperm2* intrinsics to check for shuffles
Sanjay Patel [Fri, 20 Mar 2015 22:37:20 +0000 (22:37 +0000)]
fixed vperm2* intrinsics to check for shuffles

This corresponds to llvm r232852:
http://reviews.llvm.org/rL232852

llvm-svn: 232857

9 years agoFix use of incorrect package name in sym_check
Eric Fiselier [Fri, 20 Mar 2015 22:13:37 +0000 (22:13 +0000)]
Fix use of incorrect package name in sym_check

llvm-svn: 232856

9 years agoAdd symbol checking script to libc++ to help manage exported symbols.
Eric Fiselier [Fri, 20 Mar 2015 22:09:29 +0000 (22:09 +0000)]
Add symbol checking script to libc++ to help manage exported symbols.

Summary:
Add symbol checking scripts for extracting a list of symbols from shared libraries and for comparing symbol lists for differences.

Reviewers: mclow.lists, danalbert, EricWF

Reviewed By: EricWF

Subscribers: majnemer, emaste, cfe-commits

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

llvm-svn: 232855

9 years agoTell lit.cfg about more Windows triples.
Yunzhong Gao [Fri, 20 Mar 2015 22:08:40 +0000 (22:08 +0000)]
Tell lit.cfg about more Windows triples.
For example, the host triple on my 64-bit PC is x86_64-pc-windows-msvc.

llvm-svn: 232854

9 years ago[modules] Remove temporary IdentifierInfo lookup results when we're done with them.
Richard Smith [Fri, 20 Mar 2015 21:56:50 +0000 (21:56 +0000)]
[modules] Remove temporary IdentifierInfo lookup results when we're done with them.

llvm-svn: 232853

9 years ago[X86, AVX] instcombine common cases of vperm2* intrinsics into shuffles
Sanjay Patel [Fri, 20 Mar 2015 21:47:56 +0000 (21:47 +0000)]
[X86, AVX] instcombine common cases of vperm2* intrinsics into shuffles

vperm2* intrinsics are just shuffles.
In a few special cases, they're not even shuffles.

Optimizing intrinsics in InstCombine is better than
handling this in the front-end for at least two reasons:

1. Optimizing custom-written SSE intrinsic code at -O0 makes vector coders
   really angry (and so I have regrets about some patches from last week).

2. Doing mask conversion logic in header files is hard to write and
   subsequently read.

There are a couple of TODOs in this patch to complete this optimization.

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

llvm-svn: 232852

9 years agoFixing a bug with WinEH PHI handling
Andrew Kaylor [Fri, 20 Mar 2015 21:42:54 +0000 (21:42 +0000)]
Fixing a bug with WinEH PHI handling

llvm-svn: 232851

9 years ago[X86] Prefer blendps over insertps codegen for one special case
Sanjay Patel [Fri, 20 Mar 2015 21:19:52 +0000 (21:19 +0000)]
[X86] Prefer blendps over insertps codegen for one special case

With this patch, for this one exact case, we'll generate:

  blendps %xmm0, %xmm1, $1

instead of:

  insertps %xmm0, %xmm1, $0

If there's a memory operand available for load folding and we're
optimizing for size, we'll still generate the insertps.

The detailed performance data motivation for this may be found in D7866;
in summary, blendps has 2-3x throughput vs. insertps on widely used chips.

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

llvm-svn: 232850

9 years ago[analyzer] RetainCountChecker: Don't assume +0 for ivars backing readonly properties.
Jordan Rose [Fri, 20 Mar 2015 21:12:27 +0000 (21:12 +0000)]
[analyzer] RetainCountChecker: Don't assume +0 for ivars backing readonly properties.

Similarly, don't assume +0 if the property's setter is manually implemented.
In both cases, if the property's ownership is explicitly written, then we /do/
assume the ivar has the same ownership.

rdar://problem/20218183

llvm-svn: 232849

9 years agoX86: Make helper functions static. NFC.
Benjamin Kramer [Fri, 20 Mar 2015 21:07:30 +0000 (21:07 +0000)]
X86: Make helper functions static. NFC.

llvm-svn: 232848

9 years agoRemove dead calls and function arguments dealing with TRI in StackMaps.
Eric Christopher [Fri, 20 Mar 2015 21:05:18 +0000 (21:05 +0000)]
Remove dead calls and function arguments dealing with TRI in StackMaps.

llvm-svn: 232847

9 years ago[asan] update the sized_delete_test following the change of clang flags in r232788.
Kostya Serebryany [Fri, 20 Mar 2015 20:45:42 +0000 (20:45 +0000)]
[asan] update the sized_delete_test following the change of clang flags in r232788.

llvm-svn: 232845

9 years agoDebugInfo: Require valid DIDescriptors
Duncan P. N. Exon Smith [Fri, 20 Mar 2015 20:17:07 +0000 (20:17 +0000)]
DebugInfo: Require valid DIDescriptors

As part of PR22777, switch from `dyn_cast_or_null<>` to `cast<>` in most
`DIDescriptor` accessors.  These classes are lightweight wrappers around
pointers, so the users should check for valid pointers before using
them.

This survives a Darwin clang -g bootstrap (after fixing testcases), but
it's possible the bots will complain about other configurations.  I'll
fix any fallout as quickly as I can!  Once this bakes for a bit I'll
remove the macros.

Note that `DebugLoc` implicitly gets stricter with this change as well,
since it forward to `DILocation`.  Any code that's using `DebugLoc`
accessors should check `DebugLoc::isUnknown()` first.  (BTW, I'm also
partway through a cleanup of the `DebugLoc` API to make it more obvious
what it is (a glorified pointer wrapper) and remove cruft from before
the Metadata/Value split.  I'll commit soon.)

llvm-svn: 232844

9 years agoUpdate for llvm api change.
Rafael Espindola [Fri, 20 Mar 2015 20:00:30 +0000 (20:00 +0000)]
Update for llvm api change.

llvm-svn: 232843

9 years agoDon't declare all text sections at the start of the .s
Rafael Espindola [Fri, 20 Mar 2015 20:00:01 +0000 (20:00 +0000)]
Don't declare all text sections at the start of the .s

The code this patch removes was there to make sure the text sections went
before the dwarf sections. That is necessary because MachO uses offsets
relative to the start of the file, so adding a section can change relaxations.

The dwarf sections were being printed at the start just to produce symbols
pointing at the start of those sections.

The underlying issue was fixed in r231898. The dwarf sections are now printed
when they are about to be used, which is after we printed the text sections.

To make sure we don't regress, the patch makes the MachO streamer assert
if CodeGen puts anything unexpected after the DWARF sections.

llvm-svn: 232842

9 years agoAvoid output on successful execution of the SWIG scripts
Ed Maste [Fri, 20 Mar 2015 19:59:35 +0000 (19:59 +0000)]
Avoid output on successful execution of the SWIG scripts

Standard practice for tools like this upon success is no output and a
zero return value.

llvm-svn: 232841

9 years agoFixup whitespace in finishSwigWrapperClasses.py
Ed Maste [Fri, 20 Mar 2015 19:53:49 +0000 (19:53 +0000)]
Fixup whitespace in finishSwigWrapperClasses.py

- replace hard tabs with 4-space indents
- delete EOL whitespace

llvm-svn: 232840

9 years agoBugpoint: Fix invalid 'inlinedAt:' references in testcase
Duncan P. N. Exon Smith [Fri, 20 Mar 2015 19:51:34 +0000 (19:51 +0000)]
Bugpoint: Fix invalid 'inlinedAt:' references in testcase

These are causing crashes in `DebugInfoFinder` after a WIP patch to
increase strictness of `DIDescriptor` accessors.

llvm-svn: 232839

9 years agoAsmPrinter: Check subprogram before using it
Duncan P. N. Exon Smith [Fri, 20 Mar 2015 19:50:00 +0000 (19:50 +0000)]
AsmPrinter: Check subprogram before using it

Check return of `getDISubprogram()` before using it.  A WIP patch makes
`DIDescriptor` accessors more strict (and would crash on this).

llvm-svn: 232838

9 years agoReorganize the x86 ELF relocation selection logic.
Rafael Espindola [Fri, 20 Mar 2015 19:48:54 +0000 (19:48 +0000)]
Reorganize the x86 ELF relocation selection logic.

The main differences are:

* Split in 32 and 64 bit functions.
* First switch on the Modifier so that we have only one non fully covered
  switch.
* Map the fixup kind first to a x86_64 (or i386) specific enum, to make
  it easy to handle cases like X86::reloc_riprel_4byte_movq_load.
* Switch on IsPCRel last, which reduces code duplication.

Fixes pr22308.

llvm-svn: 232837

9 years agoDwarfDebug: Check for null DebugLocs
Duncan P. N. Exon Smith [Fri, 20 Mar 2015 19:37:03 +0000 (19:37 +0000)]
DwarfDebug: Check for null DebugLocs

`DL` might be null, so check for that before using accessors.  A WIP
patch to make `DIDescriptors` more strict fails otherwise.

As a bonus, I think the logic is easier to follow now (despite the extra
nesting depth).

llvm-svn: 232836

9 years agoVerifier: Check that !dbg attachments have the right type
Duncan P. N. Exon Smith [Fri, 20 Mar 2015 19:26:58 +0000 (19:26 +0000)]
Verifier: Check that !dbg attachments have the right type

A WIP patch makes `DIDescriptor` accessors more strict, which in turn
causes the `DebugInfoFinder` to crash on wrongly typed `!dbg`
attachments.  Catch that error up front in
`Verifier::visitInstruction()`.

Also remove a test that we "handle" invalid `!dbg` attachments, added
back in r99938.  We don't want to handle those anymore.

Note: I'm *not* recursing and verifying the debug info graph reachable
from this node; that work is already done by `verifyDebugInfo()`.

llvm-svn: 232834

9 years agoDebugInfoFinder: Check for null imported entities
Duncan P. N. Exon Smith [Fri, 20 Mar 2015 19:13:53 +0000 (19:13 +0000)]
DebugInfoFinder: Check for null imported entities

Don't use the accessors in `DIImportedEntity` on a null pointer.  (A WIP
patch to make `DIDescriptor` accessors more strict crashes here
otherwise.)

llvm-svn: 232833

9 years agoSanitizerCoverage: Check for null DebugLocs
Duncan P. N. Exon Smith [Fri, 20 Mar 2015 18:48:45 +0000 (18:48 +0000)]
SanitizerCoverage: Check for null DebugLocs

After a WIP patch to make `DIDescriptor` accessors more strict, this
started asserting.

llvm-svn: 232832

9 years agoSelectionDAGBuilder: Rangeify a loop. NFC.
Hans Wennborg [Fri, 20 Mar 2015 18:48:40 +0000 (18:48 +0000)]
SelectionDAGBuilder: Rangeify a loop. NFC.

llvm-svn: 232831

9 years agoSelectionDAGBuilder::handleJTSwitchCase, simplify loop; NFC
Hans Wennborg [Fri, 20 Mar 2015 18:48:31 +0000 (18:48 +0000)]
SelectionDAGBuilder::handleJTSwitchCase, simplify loop; NFC

llvm-svn: 232830

9 years ago[UBSan] Don't allow to use UBSan with anything except for ASan.
Alexey Samsonov [Fri, 20 Mar 2015 18:45:06 +0000 (18:45 +0000)]
[UBSan] Don't allow to use UBSan with anything except for ASan.

We are not able to make a reliable solution for using UBSan together
with other sanitizers with runtime support (and sanitizer_common).
Instead, we want to follow the path used for LSan: have a "standalone"
UBSan tool, and plug-in UBSan that would be explicitly embedded into
specific sanitizers (in short term, it will be only ASan).

llvm-svn: 232829

9 years agoRewrite test/Feature/md_on_instruction.ll
Duncan P. N. Exon Smith [Fri, 20 Mar 2015 18:34:53 +0000 (18:34 +0000)]
Rewrite test/Feature/md_on_instruction.ll

This test is supposed to be testing whether metadata attachments to
instructions work, but it was using invalid debug info to do so.  (This
was causing assertion failures in the `DebugInfoFinder` with a WIP patch
to be more strict about `DIDescriptor` accessors.)

Rather than fix the debug info -- which is better tested elsewhere --
just test the IR feature directly.

llvm-svn: 232828

9 years agoCorrectly estimate SROA savings for store operands in inline cost analysis.
Wei Mi [Fri, 20 Mar 2015 18:33:12 +0000 (18:33 +0000)]
Correctly estimate SROA savings for store operands in inline cost analysis.

When estimating SROA savings, we want to see if an address is derived
off an alloca in the caller. For store instructions, operand 1 is the
address operand, but the current code uses operand 0.  Use
getPointerOperand for loads and stores to fix this.

Patch by Easwaran Raman.
http://reviews.llvm.org/D8425

llvm-svn: 232827

9 years agoSmall optimization to avoid getting pass info when we will not run loop
Daniel Berlin [Fri, 20 Mar 2015 18:05:49 +0000 (18:05 +0000)]
Small optimization to avoid getting pass info when we will not run loop

llvm-svn: 232826

9 years ago[ARM] Fix handling of thumb1 out-of-range frame offsets
John Brawn [Fri, 20 Mar 2015 17:20:07 +0000 (17:20 +0000)]
[ARM] Fix handling of thumb1 out-of-range frame offsets

LocalStackSlotPass assumes that isFrameOffsetLegal doesn't change its
answer when the base register changes. Unfortunately this isn't true
in thumb1, where SP-based loads allow a larger offset than
non-SP-based loads, and this causes the base register reuse code to
generate instructions that are unencodable, causing an assertion
failure.

Solve this by adding a BaseReg parameter to isFrameOffsetLegal, which
ARMBaseRegisterInfo can then make use of to give the correct answer.

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

llvm-svn: 232825

9 years agoMS ABI: Accept calls to an unprototyped declaration of _setjmp
David Majnemer [Fri, 20 Mar 2015 17:03:35 +0000 (17:03 +0000)]
MS ABI: Accept calls to an unprototyped declaration of _setjmp

This fixes PR22961.

llvm-svn: 232824

9 years agoTry to fix configure/make build.
Zachary Turner [Fri, 20 Mar 2015 16:23:40 +0000 (16:23 +0000)]
Try to fix configure/make build.

llvm-svn: 232823

9 years agoStripped trailing whitespace. NFC.
Simon Pilgrim [Fri, 20 Mar 2015 16:08:17 +0000 (16:08 +0000)]
Stripped trailing whitespace. NFC.

llvm-svn: 232822

9 years agoRewrite StackMap location handling to pre-compute the dwarf register
Eric Christopher [Fri, 20 Mar 2015 16:03:42 +0000 (16:03 +0000)]
Rewrite StackMap location handling to pre-compute the dwarf register
numbers before emission.

This removes a dependency on being able to access TRI at the module
level and is similar to the DwarfExpression handling. I've modified
the debug support into print/dump routines that'll do the same dumping
but is now callable anywhere and if TRI isn't available will go ahead
and just print out raw register numbers.

llvm-svn: 232821

9 years agoAt the beginning of doFinalization set the MachineFunction to
Eric Christopher [Fri, 20 Mar 2015 16:03:39 +0000 (16:03 +0000)]
At the beginning of doFinalization set the MachineFunction to
nullptr so that users get an earlier dereferencing error and
so that we can use it to conditionalize access to MachineFunction
specific data.

llvm-svn: 232820

9 years agoTypo.
Chad Rosier [Fri, 20 Mar 2015 15:45:14 +0000 (15:45 +0000)]
Typo.

llvm-svn: 232819

9 years agoR600/SI: Refactor VOP2 instruction defs
Tom Stellard [Fri, 20 Mar 2015 15:14:23 +0000 (15:14 +0000)]
R600/SI: Refactor VOP2 instruction defs

llvm-svn: 232817

9 years agoR600/SI: Refactor VOP1 instruction defs
Tom Stellard [Fri, 20 Mar 2015 15:14:21 +0000 (15:14 +0000)]
R600/SI: Refactor VOP1 instruction defs

llvm-svn: 232816

9 years agoAdd missing cases to NativeProcessLinux LogThreadStopInfo
Pavel Labath [Fri, 20 Mar 2015 14:45:13 +0000 (14:45 +0000)]
Add missing cases to NativeProcessLinux LogThreadStopInfo

Test Plan: No tests, this is just a debug logging function.

Reviewers: tberghammer

Subscribers: lldb-commits

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

llvm-svn: 232815

9 years agoReduce indentation after return. NFC.
Rafael Espindola [Fri, 20 Mar 2015 14:33:25 +0000 (14:33 +0000)]
Reduce indentation after return. NFC.

llvm-svn: 232814

9 years agoUse early returns. NFC.
Rafael Espindola [Fri, 20 Mar 2015 14:23:46 +0000 (14:23 +0000)]
Use early returns. NFC.

llvm-svn: 232813

9 years ago[ASan] fix litling warnings for coverage-order-pcs.cc
Alexander Potapenko [Fri, 20 Mar 2015 14:11:05 +0000 (14:11 +0000)]
[ASan] fix litling warnings for coverage-order-pcs.cc

llvm-svn: 232812

9 years agoFold a llvm_unreachable into an assert. NFC.
Rafael Espindola [Fri, 20 Mar 2015 13:50:15 +0000 (13:50 +0000)]
Fold a llvm_unreachable into an assert. NFC.

llvm-svn: 232811

9 years agoclang-format a function. NFC.
Rafael Espindola [Fri, 20 Mar 2015 13:47:40 +0000 (13:47 +0000)]
clang-format a function. NFC.

llvm-svn: 232810

9 years ago[ASan] Move a couple of Posix-specific tests to Posix/
Alexander Potapenko [Fri, 20 Mar 2015 13:42:11 +0000 (13:42 +0000)]
[ASan] Move a couple of Posix-specific tests to Posix/
Add a comment about potential breakage of coverage-maybe-open-file.cc on Win

llvm-svn: 232809

9 years ago[ASan] Move the coverage tests that work on Darwin to common testcase dir.
Alexander Potapenko [Fri, 20 Mar 2015 13:31:03 +0000 (13:31 +0000)]
[ASan] Move the coverage tests that work on Darwin to common testcase dir.

llvm-svn: 232808

9 years ago[Mips] Create special PLT entry in case of MIPS R6 ABI
Simon Atanasyan [Fri, 20 Mar 2015 11:28:22 +0000 (11:28 +0000)]
[Mips] Create special PLT entry in case of MIPS R6 ABI

llvm-svn: 232806

9 years agoFix ninja check-lldb
Pavel Labath [Fri, 20 Mar 2015 11:24:36 +0000 (11:24 +0000)]
Fix ninja check-lldb

Ninja apparently has issues with commands writing nul characters '\0' to stdout. When it
encounters a nul character, the rest of the output is skipped (I will file a bug with ninja about
that). This breaks the linux buildbot since it parses the ninja check-lldb output to get a list
of failures.

Recently, we have started outputting nul characters in lldb-server tests. This is probably
a bug in itself, but I am not addressing that now. This is just a workaround commit, which
prevents the nul characters from appearing in the output, and gets the buildbot operational again.

llvm-svn: 232805

9 years ago[MBP] Don't outline short optional branches
Daniel Jasper [Fri, 20 Mar 2015 10:00:37 +0000 (10:00 +0000)]
[MBP] Don't outline short optional branches

With the option -outline-optional-branches, LLVM will place optional
branches out of line (more details on r231230).

With this patch, this is not done for short optional branches. A short
optional branch is a branch containing a single block with an
instruction count below a certain threshold (defaulting to 3). Still
everything is guarded under -outline-optional-branches).

Outlining a short branch can't significantly improve code locality. It
can however decrease performance because of the additional jmp and in
cases where the optional branch is hot. This fixes a compile time
regression I have observed in a benchmark.

Review: http://reviews.llvm.org/D8108
llvm-svn: 232802

9 years agoSupport for truncate/append on log files
Pavel Labath [Fri, 20 Mar 2015 09:43:20 +0000 (09:43 +0000)]
Support for truncate/append on log files

Summary:
Presently, if a log file already exists, lldb simply starts overwriting bits of it, without
truncating or anything. This patch makes it use eFileOptionFileTruncate by default. It also adds
an --append option, which will append to the file without truncating. A test is included.

Reviewers: clayborg

Subscribers: lldb-commits

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

llvm-svn: 232801

9 years ago[MSVC] Explicit specializations can be declared in any namespace (fix for http:/...
Alexey Bataev [Fri, 20 Mar 2015 07:21:46 +0000 (07:21 +0000)]
[MSVC] Explicit specializations can be declared in any namespace (fix for llvm.org/PR13738)

MS compiler emits no errors in case of explicit specializations outside declaration enclosing namespaces, even when language extensions are disabled.
The patch is to suppress errors and emit extension warnings if explicit specializations are not declared in the corresponding namespaces.
This fixes PR13738.

Patch by Alexey Frolov.

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

llvm-svn: 232800

9 years agoInstrProf: Make profile variables private to reduce binary size overhead
Justin Bogner [Fri, 20 Mar 2015 06:34:38 +0000 (06:34 +0000)]
InstrProf: Make profile variables private to reduce binary size overhead

When we instrument a program for profiling, we copy the linkage of an
instrumented function so that our datastructures merge in the same way
as the function. This avoids redundant copies for things like
linkonce, but ends up emitting names we never need to reference for
normal and internal symbols. Promoting internal and external linkage
to private for these variables reduces the size overhead of profiling
drastically.

llvm-svn: 232799

9 years ago[Tablegen] Attempt to add support for patterns containing nodes with multiple results.
Craig Topper [Fri, 20 Mar 2015 05:09:06 +0000 (05:09 +0000)]
[Tablegen] Attempt to add support for patterns containing nodes with multiple results.

This is needed for AVX512 masked scatter/gather support.

The R600 change is necessary to remove a hack that was working around the lack of multiple results.

llvm-svn: 232798

9 years agoR600/SI: Add missing CHECK-LABEL lines to a test
Tom Stellard [Fri, 20 Mar 2015 03:12:42 +0000 (03:12 +0000)]
R600/SI: Add missing CHECK-LABEL lines to a test

llvm-svn: 232797

9 years agoFix comment from r232794. NFC
Nick Lewycky [Fri, 20 Mar 2015 02:52:23 +0000 (02:52 +0000)]
Fix comment from r232794. NFC

llvm-svn: 232796

9 years ago[bpf] fix build
Alexei Starovoitov [Fri, 20 Mar 2015 02:35:29 +0000 (02:35 +0000)]
[bpf] fix build

fix BPF backend build broken by r232699

llvm-svn: 232795

9 years agoWhen simplifying a SCEV truncate by distributing, consider it a simplification to...
Nick Lewycky [Fri, 20 Mar 2015 02:25:00 +0000 (02:25 +0000)]
When simplifying a SCEV truncate by distributing, consider it a simplification to replace a cast, even if we end up with a trunc around the term. Fixes PR22960!

llvm-svn: 232794

9 years ago[modules] Remove some redundant work when building a lookup table for a DeclContext.
Richard Smith [Fri, 20 Mar 2015 02:17:21 +0000 (02:17 +0000)]
[modules] Remove some redundant work when building a lookup table for a DeclContext.

When we need to build the lookup table for a DeclContext, we used to pull in
all lexical declarations for the context; instead, just build a lookup table
for the local lexical declarations. We previously didn't guarantee that the
imported declarations would be in the returned map, but in some cases we'd
happen to put them all in there regardless. Now we're even lazier about this.

This unnecessary work was papering over some other bugs:

 - LookupVisibleDecls would use the DC for name lookups in the TU in C, and
   this was not guaranteed to find all imported names (generally, the DC for
   the TU in C is not a reliable place to perform lookups). We now use an
   identifier-based lookup mechanism for this.

 - We didn't actually load in the list of eagerly-deserialized declarations
   when importing a module (so external definitions in a module wouldn't be
   emitted by users of those modules unless they happened to be deserialized
   by the user of the module).

llvm-svn: 232793

9 years agoSampleProfile: Check for missing debug locations
Duncan P. N. Exon Smith [Fri, 20 Mar 2015 00:56:55 +0000 (00:56 +0000)]
SampleProfile: Check for missing debug locations

Don't use `DebugLoc` accessors if we're pointing at null, which will be
a problem after a WIP patch to make the `DIDescriptor` accessors more
strict.  Caught by Frontend/profile-sample-use-loc-tracking.c (in
clang).

llvm-svn: 232792

9 years agoDebugInfo: Check for null before using DIType
Duncan P. N. Exon Smith [Fri, 20 Mar 2015 00:53:40 +0000 (00:53 +0000)]
DebugInfo: Check for null before using DIType

A WIP patch to turn on stricter `DIDescriptor` accessor checks fires
here; it's obvious from the code that `T` can be null, so add an
explicit check.  Caught by dozens of current testcases.

llvm-svn: 232791

9 years agoVerifier: Remove the separate DebugInfoVerifier class
Duncan P. N. Exon Smith [Fri, 20 Mar 2015 00:48:23 +0000 (00:48 +0000)]
Verifier: Remove the separate DebugInfoVerifier class

Remove the separate `DebugInfoVerifier` class, as a partial step toward
better integrating debug info verification with the `Verifier`.

Right now, verification of debug info is kind of a mess.

  - There are `DIDescriptor::Verify()` checks live in `DebugInfo.cpp`.
    These return `bool`, and there's no way to see (except by opening a
    debugger) why they fail.
  - We rely on `DebugInfoFinder` to traverse the debug info graph and
    dig up nodes.  However, the regular `Verifier` visits many of these
    nodes when it calls into debug info intrinsic operands.  Visiting
    twice and running different checks is kind of absurd.
  - Moreover, `DebugInfoFinder` asserts on failed type resolution -- the
    verifier should never assert!

By integrating the two verifiers, I'm aiming at solving these problems
(work to be done, obviously).  Verification can be localized to the
`Verifier`; we can use a naive `MDNode` operand traversal to find all
the nodes; we can verify type references instead of asserting on
failure.

There are `assert()`s sprinkled throughout the optimizer and dwarf
backend on `DIDescriptor::Verify()` checks.  This is a hangover from
when the debug info verifier was off, so I plan to remove them as I go
(once I confirm that the checks are done at verification time).

Note: to keep the behaviour of only running the debug info verifier when
-verify succeeds, I've added an `EverBroken` flag.  Once the
`DebugInfoFinder` assertions are gone and the two traversals have been
merged, I expect to be able to remove this.

llvm-svn: 232790

9 years agoRewrite SelectionDAGBuilder::Clusterify to run in linear time. NFC.
Hans Wennborg [Fri, 20 Mar 2015 00:41:03 +0000 (00:41 +0000)]
Rewrite SelectionDAGBuilder::Clusterify to run in linear time. NFC.

It was previously repeatedly erasing elements from the middle of a vector,
causing O(n^2) worst-case run-time.

llvm-svn: 232789

9 years agoC++14: Disable sized deallocation by default due to ABI breakage
Reid Kleckner [Fri, 20 Mar 2015 00:31:07 +0000 (00:31 +0000)]
C++14: Disable sized deallocation by default due to ABI breakage

There are no widely deployed standard libraries providing sized
deallocation functions, so we have to punt and ask the user if they want
us to use sized deallocation. In the future, when such libraries are
deployed, we can teach the driver to detect them and enable this
feature.

N3536 claimed that a weak thunk from sized to unsized deallocation could
be emitted to avoid breaking backwards compatibility with standard
libraries not providing sized deallocation. However, this approach and
other variations don't work in practice.

With the weak function approach, the thunk has to have default
visibility in order to ensure that it is overridden by other DSOs
providing sized deallocation. Weak, default visibility symbols are
particularly expensive on MachO, so John McCall was considering
disabling this feature by default on Darwin. It also changes behavior
ELF linking behavior, causing certain otherwise unreferenced object
files from an archive to be pulled into the link.

Our second approach was to use an extern_weak function declaration and
do an inline conditional branch at the deletion call site. This doesn't
work because extern_weak only works on MachO if you have some archive
providing the default value of the extern_weak symbol. Arranging to
provide such an archive has the same challenges as providing the symbol
in the standard library. Not to mention that extern_weak doesn't really
work on COFF.

Reviewers: rsmith, rjmccall

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

llvm-svn: 232788

9 years agoAllow -fsanitize-coverage with -fsanitize=dataflow
Kostya Serebryany [Fri, 20 Mar 2015 00:06:52 +0000 (00:06 +0000)]
Allow -fsanitize-coverage with -fsanitize=dataflow

Summary: Allow -fsanitize-coverage with -fsanitize=dataflow

Test Plan: check-clang

Reviewers: pcc

Reviewed By: pcc

Subscribers: cfe-commits

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

llvm-svn: 232787

9 years agoDon't crash-on-valid when an inline function is friend of class template
David Majnemer [Fri, 20 Mar 2015 00:02:27 +0000 (00:02 +0000)]
Don't crash-on-valid when an inline function is friend of class template

We assumed that the most recent declaration of an inline function would
also be inline.  However, a more recent declaration can come from a
friend declaration in a class template that is instantiated at the
definition of the function.

llvm-svn: 232786

9 years agotest: Make a start on a test suite for libLTO.
Peter Collingbourne [Thu, 19 Mar 2015 23:55:38 +0000 (23:55 +0000)]
test: Make a start on a test suite for libLTO.

This works in a similar way to the gold plugin tests. We search for a compatible
linker on $PATH and use it to run tests against our just-built libLTO. To start
with, test the just added opt level functionality.

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

llvm-svn: 232785

9 years agoReport watchpoint hits during single stepping.
Chaoren Lin [Thu, 19 Mar 2015 23:28:10 +0000 (23:28 +0000)]
Report watchpoint hits during single stepping.

Summary:
Reorganized NativeProcessLinux::MonitorSIGTRAP to check for watchpoint hits on
TRAP_TRACE.

Added test for stepping over watchpoints.

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

Reviewers: ovyalov, tberghammer, vharron, clayborg

Subscribers: jingham, labath, lldb-commits

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

llvm-svn: 232784