platform/upstream/llvm.git
9 years agoCOFF: Fix ICF correctness bug.
Rui Ueyama [Sun, 28 Jun 2015 01:30:54 +0000 (01:30 +0000)]
COFF: Fix ICF correctness bug.

When comparing two COMDAT sections, we need to take section values
and associative sections into account. This patch fixes that bug.
It fixes a crash bug of llvm-tblgen when linked with /opt:lldicf.

One thing I don't understand yet is that this logic seems to be
too strict. MSVC linker is able to create more compact executables
(which of course work correctly). With this ICF algorithm, LLD is
able to make executable smaller, but the outputs are larger than
MSVC's. There must be something I'm missing here.

llvm-svn: 240897

9 years agoclang-format: Support @autoreleasepool.
Nico Weber [Sun, 28 Jun 2015 01:06:16 +0000 (01:06 +0000)]
clang-format: Support @autoreleasepool.

Format @autoreleasepool properly for the Attach brace style
by recognizing @autoreleasepool as a block introducer.

Patch from Strager Neds!
http://reviews.llvm.org/D10372

llvm-svn: 240896

9 years agoReplace `rm -rf` with more portable implementation.
Chaoren Lin [Sat, 27 Jun 2015 23:11:34 +0000 (23:11 +0000)]
Replace `rm -rf` with more portable implementation.

Reviewers: clayborg, vharron

Subscribers: lldb-commits

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

llvm-svn: 240895

9 years agotimegm in LibcGlue needs to be extern, not static.
Chaoren Lin [Sat, 27 Jun 2015 23:11:32 +0000 (23:11 +0000)]
timegm in LibcGlue needs to be extern, not static.

Reviewers: vharron

Reviewed By: vharron

Subscribers: lldb-commits

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

llvm-svn: 240894

9 years agoRevert "Debug Info: One more bitfield bugfix. While yesterday's r240853 fixed"
Adrian Prantl [Sat, 27 Jun 2015 21:55:00 +0000 (21:55 +0000)]
Revert "Debug Info: One more bitfield bugfix. While yesterday's r240853 fixed"

This reverts commit 240890. Breaking the gdb buildbot.

llvm-svn: 240893

9 years agoDon't use %llc_dwarf for target-specific tests.
Benjamin Kramer [Sat, 27 Jun 2015 21:11:43 +0000 (21:11 +0000)]
Don't use %llc_dwarf for target-specific tests.

Should fix running them on windows.

llvm-svn: 240892

9 years ago[SDAG] Now that we have a way to communicate the exact bit on sdiv use it to simplify...
Benjamin Kramer [Sat, 27 Jun 2015 20:33:26 +0000 (20:33 +0000)]
[SDAG] Now that we have a way to communicate the exact bit on sdiv use it to simplify sdiv by a constant.

We had a hack in SDAGBuilder in place to work around this but now we
can avoid that. Call BuildExactSDIV from BuildSDIV so DAGCombiner can
perform this trick automatically.

The added check in DAGCombiner is necessary to prevent exact sdiv by pow2
from regressing as the target-specific pow2 lowering is not aware of
exact bits yet.

This is mostly covered by existing tests. One side effect is that we
get the better lowering for exact vector sdivs now too :)

llvm-svn: 240891

9 years agoDebug Info: One more bitfield bugfix. While yesterday's r240853 fixed
Adrian Prantl [Sat, 27 Jun 2015 20:12:43 +0000 (20:12 +0000)]
Debug Info: One more bitfield bugfix. While yesterday's r240853 fixed
the DW_AT_bit_offset computation, the byte offset is in fact also
endian-dependent as it needs to point to the storage unit containing the
most-significant bit of the the bitfield.
I'm so looking forward to emitting the endian-agnostic DWARF 3 version
instead.

llvm-svn: 240890

9 years ago[Sema] Unions cannot have virtual functions.
Davide Italiano [Sat, 27 Jun 2015 19:18:55 +0000 (19:18 +0000)]
[Sema] Unions cannot have virtual functions.

PR: PR23931
Differential Revision: http://reviews.llvm.org/D10752
Reviewed by:  rsmith

llvm-svn: 240889

9 years agoFix typo. NFC.
Alex Denisov [Sat, 27 Jun 2015 19:04:55 +0000 (19:04 +0000)]
Fix typo. NFC.

llvm-svn: 240888

9 years ago[mips] Fold duplicate big-endian disassembler tests together.
Daniel Sanders [Sat, 27 Jun 2015 17:56:44 +0000 (17:56 +0000)]
[mips] Fold duplicate big-endian disassembler tests together.

llvm-svn: 240887

9 years agoAdd ABI/SysV-mips(64) to Makefile build
Keno Fischer [Sat, 27 Jun 2015 17:31:28 +0000 (17:31 +0000)]
Add ABI/SysV-mips(64) to Makefile build

The Makefile build was broken without this.

llvm-svn: 240886

9 years ago[mips] Sort big-endian disassembler tests by opcode.
Daniel Sanders [Sat, 27 Jun 2015 16:13:59 +0000 (16:13 +0000)]
[mips] Sort big-endian disassembler tests by opcode.

llvm-svn: 240885

9 years ago[mips] Make little-endian disassembler test filenames consistent.
Daniel Sanders [Sat, 27 Jun 2015 15:42:25 +0000 (15:42 +0000)]
[mips] Make little-endian disassembler test filenames consistent.

Most are named *-el.txt. Renamed the three that were *-le.txt

llvm-svn: 240884

9 years ago[mips] Add COP0 register class and use it in M[FT]C0/DM[FT]C0.
Daniel Sanders [Sat, 27 Jun 2015 15:39:19 +0000 (15:39 +0000)]
[mips] Add COP0 register class and use it in M[FT]C0/DM[FT]C0.

Summary:
Previously it (incorrectly) used GPR's.

Patch by Simon Dardis. A couple small corrections by myself.

Reviewers: dsanders

Reviewed By: dsanders

Subscribers: llvm-commits

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

llvm-svn: 240883

9 years ago[OCaml] Bump ctypes dependency to 0.4.
Peter Zotov [Sat, 27 Jun 2015 14:32:30 +0000 (14:32 +0000)]
[OCaml] Bump ctypes dependency to 0.4.

ctypes 0.3 and earlier contains an interface-definig bug:
its ptr_of_raw_address accepts Int64 and not Nativeint. ctypes 0.4
was not released during the 3.6 cycle, and because of that, LLVM 3.6
was released with ctypes 0.3 as a dependency, which now breaks
the build on modern ctypes.

Unbreak.

llvm-svn: 240882

9 years agoProperly initialize Module pointer
Jeroen Ketema [Sat, 27 Jun 2015 12:35:54 +0000 (12:35 +0000)]
Properly initialize Module pointer

llvm-svn: 240881

9 years agoclang-format: Fix language of DisableFormat description
Birunthan Mohanathas [Sat, 27 Jun 2015 09:25:28 +0000 (09:25 +0000)]
clang-format: Fix language of DisableFormat description

This is a comment-only change to test commit access.

llvm-svn: 240879

9 years ago[msan] Fix infinite recursion when _Unwind_Backtrace calls memcpy
Jay Foad [Sat, 27 Jun 2015 08:39:12 +0000 (08:39 +0000)]
[msan] Fix infinite recursion when _Unwind_Backtrace calls memcpy

Summary:
On PPC64, half the msan tests fail with an infinite recursion through
GetStackTrace like this:

#0 __msan::GetStackTrace
#1 __msan_memcpy
#2 ?? () from /lib64/libgcc_s.so.1
#3 ?? () from /lib64/libgcc_s.so.1
#4 _Unwind_Backtrace
#5 __sanitizer::BufferedStackTrace::SlowUnwindStack
#6 __sanitizer::BufferedStackTrace::Unwind
#7 __msan::GetStackTrace
#8 __interceptor_calloc
#9 _dl_allocate_tls
#10 pthread_create@@GLIBC_2.17
#11 __interceptor_pthread_create
#12 main

The problem is that we call _Unwind_Backtrace to get a stack trace; but
_Unwind_Backtrace calls memcpy, which we intercept and try to get
another stack trace.

This patch fixes it in __msan_memcpy by skipping the stack trace if
IsInSymbolizer(). This works because GetStackTrace already creates a
SymbolizerScope to "block reports from our interceptors during
_Unwind_Backtrace".

Reviewers: samsonov, wschmidt, eugenis

Reviewed By: eugenis

Subscribers: llvm-commits

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

llvm-svn: 240878

9 years ago[LoopVectorize] Pointer indicies may be wider than the pointer
David Majnemer [Sat, 27 Jun 2015 08:38:17 +0000 (08:38 +0000)]
[LoopVectorize] Pointer indicies may be wider than the pointer

If we are dealing with a pointer induction variable, isInductionPHI
gives back a step value of Stride / size of pointer.  However, we might
be indexing with a legal type wider than the pointer width.
Handle this by inserting casts where appropriate instead of crashing.

This fixes PR23954.

llvm-svn: 240877

9 years ago[PruneEH] A naked, noinline function can return via InlineAsm
David Majnemer [Sat, 27 Jun 2015 07:52:53 +0000 (07:52 +0000)]
[PruneEH] A naked, noinline function can return via InlineAsm

The PruneEH pass tries to annotate functions as 'noreturn' if it doesn't
see a ReturnInst.  However, a naked function containing inline assembly
can contain control flow leaving the function.

This fixes PR23971.

llvm-svn: 240876

9 years ago[Stackmap] Pre-assemble the stackmap parser test case. (Fix builders).
Lang Hames [Sat, 27 Jun 2015 03:49:25 +0000 (03:49 +0000)]
[Stackmap] Pre-assemble the stackmap parser test case. (Fix builders).

This case had been failing on testers that didn't have x86 support. Rather
than XFAIL it on testers without x86 support, I've just assembled it and used
the raw object as the test input.

llvm-svn: 240875

9 years agollvm/test/CodeGen/X86/xor.ll: Appease Win32 targets since r240796.
NAKAMURA Takumi [Sat, 27 Jun 2015 03:46:58 +0000 (03:46 +0000)]
llvm/test/CodeGen/X86/xor.ll: Appease Win32 targets since r240796.

  %struct.ref_s = type { %union.v, i16, i16 }
  %union.v = type { i64 }

It seems %struct.ref_s is incompatible in tail padding.

llvm-svn: 240874

9 years ago[opt] Inline a trivial lookup function into the header.
Chandler Carruth [Sat, 27 Jun 2015 03:40:10 +0000 (03:40 +0000)]
[opt] Inline a trivial lookup function into the header.

This function is actually *very* hot. It is hard to see currently
because the call graph is very recursive, but I'm working to remove that
and when I do this function becomes significantly higher on the profile
(up to 5%!) and so worth avoiding the call overhead.

No specific perf gain I can measure yet (below the noise), but likely to
have more impact as we stop cluttering the call graph.

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

llvm-svn: 240873

9 years agoSuppress clang/test/CodeGen/builtins-ppc-p8vector.c for -Asserts for now. Will fix...
NAKAMURA Takumi [Sat, 27 Jun 2015 03:33:47 +0000 (03:33 +0000)]
Suppress clang/test/CodeGen/builtins-ppc-p8vector.c for -Asserts for now. Will fix later.

llvm-svn: 240872

9 years agoSwitch the new COFF linker's symbol table to use a DenseMap of
Chandler Carruth [Sat, 27 Jun 2015 02:05:40 +0000 (02:05 +0000)]
Switch the new COFF linker's symbol table to use a DenseMap of
StringRefs. This uses the LLVM hashing rather than the standard library
and a closed addressed hash table rather than chaining.

This improves the Windows self-link of LLD by 4.4% (averaged over 10
runs, with well under 1% of variance on each).

There is still some room to improve here. Two things I clearly see in
the profile:

1) This is one of the biggest stress tests for the LLVM hashing code. It
   actually consumes something like 3-4% of the link time after the
   change.
2) The way that StringRef keys are handled in the DenseMap interface is
   pretty suboptimal. We pay the price of checking for empty and
   tombstone keys when we could only possibly be looking for a normal
   key. But fixing this requires invasive API changes.

So there is still some headroom here.

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

llvm-svn: 240871

9 years ago[MC] Ensure that pending labels are flushed when -mc-relax-all flag is used
Petr Hosek [Sat, 27 Jun 2015 01:54:17 +0000 (01:54 +0000)]
[MC] Ensure that pending labels are flushed when -mc-relax-all flag is used

Summary:
The current implementation doesn't always flush all pending labels
beforeemitting data which can result in an incorrectly placed labels in
case when when instruction bundling is enabled and -mc-relax-all flag is
being used. To address this issue, we always flush pending labels before
emitting data.

The change was tested by running PNaCl toolchain trybots with
-mc-relax-all flag set.

Fixes https://code.google.com/p/nativeclient/issues/detail?id=4063

Test Plan: Regression test attached

Reviewers: mseaborn

Subscribers: jfb, llvm-commits

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

llvm-svn: 240870

9 years ago[MC] Align fragments when -mc-relax-all flag is used
Petr Hosek [Sat, 27 Jun 2015 01:49:53 +0000 (01:49 +0000)]
[MC] Align fragments when -mc-relax-all flag is used

Summary:
Ensure that fragments are bundle aligned when instruction bundling
is enabled and the -mc-relax-all flag is set. This is implicitly
assumed by the bundle padding implementation but this assumption
does not hold when custom alignment is being used.

The change was tested by running PNaCl toolchain trybots with
-mc-relax-all flag set.

Fixes https://code.google.com/p/nativeclient/issues/detail?id=4063

Test Plan: Regression test attached

Reviewers: mseaborn

Subscribers: jfb, llvm-commits

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

llvm-svn: 240869

9 years agoAsmPrinter: Document why DIEValueList uses a linked-list, NFC
Duncan P. N. Exon Smith [Sat, 27 Jun 2015 01:19:17 +0000 (01:19 +0000)]
AsmPrinter: Document why DIEValueList uses a linked-list, NFC

There are two main reasons why a linked-list makes sense for
`DIEValueList`.

 1. We want `DIE` to be on a `BumpPtrAllocator` to improve teardown
    efficiency.  Making `DIEValueList` array-based would make that much
    more complicated.
 2. The singly-linked list is fairly memory efficient.  The histogram
    [1] shows that most DIEs have relatively few values, so we often pay
    less than the 2/3-pointer static overhead of a vector.  Furthermore,
    we don't know ahead of time exactly how many values a `DIE` needs,
    so a vector-like scheme will on average over-allocate by ~50%.  As
    it happens, that's the same memory overhead as the linked list node.

[1]: http://lists.cs.uiuc.edu/pipermail/llvmdev/2015-May/085910.html

The comment I added to the code is a little more succinct, but I think
it's enough to give the idea.

llvm-svn: 240868

9 years agoIR: Expose ModuleSlotTracker in Value::print()
Duncan P. N. Exon Smith [Sat, 27 Jun 2015 00:38:26 +0000 (00:38 +0000)]
IR: Expose ModuleSlotTracker in Value::print()

Allow callers of `Value::print()` and `Metadata::print()` to pass in a
`ModuleSlotTracker`.  This allows them to pay only once for calculating
module-level slots (such as Metadata).

This is related to PR23865, where there was a huge cost for
`MachineFunction::print()`.  Although I don't have a *particular* user
in mind for this new code, I have hit big slowdowns before when running
`opt -debug`, and I think this will be useful.  Going forward, if
someone hits a big slowdown with `print()` statements, they can create a
`ModuleSlotTracker` and send it through.  Similarly, adding support to
`Value::dump()` and `Metadata::dump()` should be trivial.

I added unit tests to be sure the `print()` functions actually behave
the same way with and without the slot tracker.

llvm-svn: 240867

9 years agoLowerBitSets: Ignore bitset entries that do not directly refer to a global.
Peter Collingbourne [Sat, 27 Jun 2015 00:17:51 +0000 (00:17 +0000)]
LowerBitSets: Ignore bitset entries that do not directly refer to a global.

It is possible for a global to be substituted with another global of a
different type or a different kind (i.e. an alias) at IR link time. One
example of this scenario is when a Microsoft ABI vtable is substituted with
an alias referring to a larger vtable containing an RTTI reference.

This will cause the global to be RAUW'd with a possibly bitcasted reference
to the other global. This will of course also affect any references to the
global in bitset metadata.

The right way to handle such metadata is simply to ignore it. This is sound
because the linked module should contain another copy of the bitset entries as
applied to the new global.

llvm-svn: 240866

9 years agoPlug a leak introduced by r240848
Duncan P. N. Exon Smith [Sat, 27 Jun 2015 00:15:32 +0000 (00:15 +0000)]
Plug a leak introduced by r240848

Apparently this obvious leak was never exercised before, but r240848
exposed it.  Plug it.

http://lab.llvm.org:8011/builders/sanitizer-x86_64-linux-fast/builds/5075

llvm-svn: 240865

9 years agoFix some compiler warnings about not using override consistently.
Greg Clayton [Sat, 27 Jun 2015 00:12:59 +0000 (00:12 +0000)]
Fix some compiler warnings about not using override consistently.

llvm-svn: 240864

9 years agoAdd original source code to test case as suggested in review.
Adrian Prantl [Sat, 27 Jun 2015 00:01:33 +0000 (00:01 +0000)]
Add original source code to test case as suggested in review.

llvm-svn: 240863

9 years agoCOFF: Use vector::erase instead of reallocating entire vector. NFC.
Rui Ueyama [Fri, 26 Jun 2015 23:59:13 +0000 (23:59 +0000)]
COFF: Use vector::erase instead of reallocating entire vector. NFC.

llvm-svn: 240862

9 years agoAdd test for SBValue.GetNonSyntheticValue in presence of synth provider.
Siva Chandra [Fri, 26 Jun 2015 23:57:38 +0000 (23:57 +0000)]
Add test for SBValue.GetNonSyntheticValue in presence of synth provider.

Test Plan: dotest.py -p TestFormattersSBAPI

Reviewers: granata.enrico

Reviewed By: granata.enrico

Subscribers: lldb-commits

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

llvm-svn: 240861

9 years ago[StackMaps] Add a lightweight parser for stackmap version 1 sections.
Lang Hames [Fri, 26 Jun 2015 23:56:53 +0000 (23:56 +0000)]
[StackMaps] Add a lightweight parser for stackmap version 1 sections.

The parser provides a convenient interface for reading llvm stackmap v1 sections
in object files.

This patch also includes a new option for llvm-readobj, '-stackmap', which uses
the parser to pretty-print stackmap sections for debugging/testing purposes.

llvm-svn: 240860

9 years agoCOFF: Avoid vector reallocation. NFC.
Rui Ueyama [Fri, 26 Jun 2015 23:51:45 +0000 (23:51 +0000)]
COFF: Avoid vector reallocation. NFC.

llvm-svn: 240859

9 years ago[asan] Disable 3 tests on Android.
Evgeniy Stepanov [Fri, 26 Jun 2015 23:44:43 +0000 (23:44 +0000)]
[asan] Disable 3 tests on Android.

Different reasons for failing; see source file comments.

llvm-svn: 240858

9 years ago[asan] Add -pie to uninstrumented executables on interface_test.cc
Evgeniy Stepanov [Fri, 26 Jun 2015 23:43:03 +0000 (23:43 +0000)]
[asan] Add -pie to uninstrumented executables on interface_test.cc

This helps Android (which only support PIE) and does not hurt anything else.

llvm-svn: 240857

9 years ago[asan] Enable 2 tests on Android.
Evgeniy Stepanov [Fri, 26 Jun 2015 23:41:50 +0000 (23:41 +0000)]
[asan] Enable 2 tests on Android.

Due to bionic improvements and "recent" sized-delete changes in clang.

llvm-svn: 240856

9 years ago[asan] Disable -O1,-O2,-O3 in clang_gcc_abi.cc test.
Evgeniy Stepanov [Fri, 26 Jun 2015 23:40:27 +0000 (23:40 +0000)]
[asan] Disable -O1,-O2,-O3 in clang_gcc_abi.cc test.

A workaround for PR23971.
Fixes the test on Android.

llvm-svn: 240855

9 years ago[asan] Disable glibc-specific code chunk on Android.
Evgeniy Stepanov [Fri, 26 Jun 2015 23:39:23 +0000 (23:39 +0000)]
[asan] Disable glibc-specific code chunk on Android.

Fixes quarantine_size_mb.cc test on the Android bot.

llvm-svn: 240854

9 years agoDebug Info: Fix a bug in the DW_AT_bit_offset calculation that would
Adrian Prantl [Fri, 26 Jun 2015 23:31:27 +0000 (23:31 +0000)]
Debug Info: Fix a bug in the DW_AT_bit_offset calculation that would
result in negative offsets and attempt a better job at documenting
the algorithm.

rdar://21082998

llvm-svn: 240853

9 years agoCodeGen: Create a proper ModuleSlotTracker for MachineInstr
Duncan P. N. Exon Smith [Fri, 26 Jun 2015 23:18:44 +0000 (23:18 +0000)]
CodeGen: Create a proper ModuleSlotTracker for MachineInstr

Another follow-up related to r240848: try a little harder to share slot
tracking calculations within a single `MachineInstr` dump.  This is
unrelated to `MachineFunction::print()`, since that should be passing
through the function's `ModuleSlotTracker` by now, but could affect the
speed of dumping from a debugger if there is more than one IR-level
operand.

llvm-svn: 240852

9 years agoMIR Serialization: Serialize global address machine operands.
Alex Lorenz [Fri, 26 Jun 2015 22:56:48 +0000 (22:56 +0000)]
MIR Serialization: Serialize global address machine operands.

This commit serializes the global address machine operands.
This commit doesn't serialize the operand's offset and target
flags, it serializes only the global value reference.

Reviewers: Duncan P. N. Exon Smith

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

llvm-svn: 240851

9 years ago[RewriteStatepointsForGC] Generalized vector phi/select handling for base pointers
Philip Reames [Fri, 26 Jun 2015 22:47:37 +0000 (22:47 +0000)]
[RewriteStatepointsForGC] Generalized vector phi/select handling for base pointers

This change extends the detection of base pointers for vector constructs to handle arbitrary phi and select nodes. The existing non-vector code already handles those, so this is basically just extending the vector special case to be less special cased. It still isn't generalized vector handling since we can't handle arbitrary vector instructions (e.g. shufflevectors), but it's a lot closer.

The general structure of the change is as follows:
 * Extend the base defining value relation over a subset of vector instructions and vector typed phi & select instructions.
 * Move scalarization from before base pointer rewriting to after base pointer rewriting. The extension of the BDV relation is sufficient to find vector base phis for vector inputs.
 * Preserve the existing special case logic for when the base of a vector element is locally obvious. This general idea could be extended to the scalar case as well.

Differential Revision: http://reviews.llvm.org/D10461#inline-84275

llvm-svn: 240850

9 years ago[NVPTX] noop when kernel pointers are already global
Jingyue Wu [Fri, 26 Jun 2015 22:35:43 +0000 (22:35 +0000)]
[NVPTX] noop when kernel pointers are already global

Summary:
Some front ends make kernel pointers global already. In that case,
handlePointerParams does nothing.

Test Plan: more tests in lower-kernel-ptr-arg.ll

Reviewers: grosser

Subscribers: jholewinski, llvm-commits

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

llvm-svn: 240849

9 years agoCodeGen: Push the ModuleSlotTracker through Metadata
Duncan P. N. Exon Smith [Fri, 26 Jun 2015 22:28:47 +0000 (22:28 +0000)]
CodeGen: Push the ModuleSlotTracker through Metadata

For another 1% speedup on the testcase in PR23865, push the
`ModuleSlotTracker` through to metadata-related printing in
`MachineBasicBlock::print()`.

llvm-svn: 240848

9 years agoMinor style cleanup after 240843 [NFC]
Philip Reames [Fri, 26 Jun 2015 22:21:52 +0000 (22:21 +0000)]
Minor style cleanup after 240843 [NFC]

Use a for-each loop in one case and rename the function to reflect it's new usage.

llvm-svn: 240847

9 years agoCOFF: Remove dead code.
Rui Ueyama [Fri, 26 Jun 2015 22:14:41 +0000 (22:14 +0000)]
COFF: Remove dead code.

llvm-svn: 240846

9 years agoCodeGen: Push the ModuleSlotTracker through MachineOperands
Duncan P. N. Exon Smith [Fri, 26 Jun 2015 22:06:47 +0000 (22:06 +0000)]
CodeGen: Push the ModuleSlotTracker through MachineOperands

Push `ModuleSlotTracker` through `MachineOperand`s, dropping the time
for `llc -print-machineinstrs` on the testcase in PR23865 from ~13
seconds to ~9 seconds.  Now `SlotTracker::processFunctionMetadata()`
accounts for only 8% of the runtime, which seems reasonable.

llvm-svn: 240845

9 years agoCOFF: Add base relocation for delay-import table.
Rui Ueyama [Fri, 26 Jun 2015 22:05:32 +0000 (22:05 +0000)]
COFF: Add base relocation for delay-import table.

Because the address table of the delay-import table contains
absolute address, it needs to be added to the base relocation
table.

llvm-svn: 240844

9 years ago[Verifier] Follow on to 240836
Philip Reames [Fri, 26 Jun 2015 22:04:34 +0000 (22:04 +0000)]
[Verifier] Follow on to 240836

Address one missed review comment and do the rename I left out of that patch to make it reviewable.

llvm-svn: 240843

9 years agoCodeGen: Use a single SlotTracker in MachineFunction::print()
Duncan P. N. Exon Smith [Fri, 26 Jun 2015 22:04:20 +0000 (22:04 +0000)]
CodeGen: Use a single SlotTracker in MachineFunction::print()

Expose enough of the IR-level `SlotTracker` so that
`MachineFunction::print()` can use a single one for printing
`BasicBlock`s.  Next step would be to lift this through a few more APIs
so that we can make other print methods faster.

Fixes PR23865, changing the runtime of `llc -print-machineinstrs` from
many minutes (killed after 3 minutes, but it wasn't very close) to
13 seconds for a 502185 line dump.

llvm-svn: 240842

9 years agoAMDPGU/SI: Use correct resource descriptors for VI on HSA
Tom Stellard [Fri, 26 Jun 2015 21:58:42 +0000 (21:58 +0000)]
AMDPGU/SI: Use correct resource descriptors for VI on HSA

Summary: We need to set MTYPE = 2 for VI shaders when targeting the HSA runtime.

Reviewers: arsenm

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

llvm-svn: 240841

9 years agoIncrease the dependence-analysis compute out
Tobias Grosser [Fri, 26 Jun 2015 21:58:42 +0000 (21:58 +0000)]
Increase the dependence-analysis compute out

As Polly got a lot faster after the small-integer-optimization imath
patch, we now increase the compute out to optimize larger kernels. This
should also expose additional slow-downs for us to address.

In LNT this gives us a 3.4x speedup on 3mm, at a cost of a 2x increase in
compile time (now 0.77s). reg_detect, oorafft and adi also show some compile
time increases. This compile time cost is divided between more time in isl and
more time in LLVM's backends due to increased code size (versioning and tiling).

llvm-svn: 240840

9 years agoAMDGPU/SI: Update amd_kernel_code_t definition and add assembler support
Tom Stellard [Fri, 26 Jun 2015 21:58:31 +0000 (21:58 +0000)]
AMDGPU/SI: Update amd_kernel_code_t definition and add assembler support

Reviewers: arsenm

Subscribers: llvm-commits

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

llvm-svn: 240839

9 years agoAMDGPU/SI: Remove unused variable
Tom Stellard [Fri, 26 Jun 2015 21:58:26 +0000 (21:58 +0000)]
AMDGPU/SI: Remove unused variable

This should fix some bots that were broken by r240831.

llvm-svn: 240838

9 years agoCOFF: Fix delay-import tables.
Rui Ueyama [Fri, 26 Jun 2015 21:40:15 +0000 (21:40 +0000)]
COFF: Fix delay-import tables.

There were a few issues with the previous delay-import tables.

 - "Attribute" field should have been 1 instead of 0.
   (I don't know the meaning of this field, though.)
 - LEA and CALL operands had wrong addresses.
 - Address tables are in .didat (which is read-only).
   They should have been in .data.

llvm-svn: 240837

9 years ago[Verifier] Verify invokes of intrinsics
Philip Reames [Fri, 26 Jun 2015 21:39:44 +0000 (21:39 +0000)]
[Verifier] Verify invokes of intrinsics

We support invoking a subset of llvm's intrinsics, but the verifier didn't account for this.  We had previously added a special case to verify invokes of statepoints.  By generalizing the code in terms of CallSite, we can verify invokes of other intrinsics as well.  Interestingly, this found one test case which was invalid.

Note: I'm deliberately leaving the naming change from CI to CS to a follow up change.  That will happen shortly, I just wanted to reduce the diff to make it clear what was happening with this one.

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

llvm-svn: 240836

9 years agoDebug Info: Clarify the documentation for bitfields emission.
Adrian Prantl [Fri, 26 Jun 2015 21:27:30 +0000 (21:27 +0000)]
Debug Info: Clarify the documentation for bitfields emission.

llvm-svn: 240835

9 years agoDebug info: Add more test coverage for bitfields.
Adrian Prantl [Fri, 26 Jun 2015 21:27:16 +0000 (21:27 +0000)]
Debug info: Add more test coverage for bitfields.

llvm-svn: 240834

9 years agoAdd a testcase for bitfield debug info.
Adrian Prantl [Fri, 26 Jun 2015 21:25:18 +0000 (21:25 +0000)]
Add a testcase for bitfield debug info.

llvm-svn: 240833

9 years agoAMDGPU/SI: Set ELF OS/ABI to ELFOSABI_AMDGPU_HSA
Tom Stellard [Fri, 26 Jun 2015 21:15:11 +0000 (21:15 +0000)]
AMDGPU/SI: Set ELF OS/ABI to ELFOSABI_AMDGPU_HSA

Reviewers: arsenm, rafael

Subscribers: llvm-commits

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

llvm-svn: 240832

9 years agoAMDGPU/SI: Add hsa code object directives
Tom Stellard [Fri, 26 Jun 2015 21:15:07 +0000 (21:15 +0000)]
AMDGPU/SI: Add hsa code object directives

Reviewers: arsenm

Subscribers: llvm-commits

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

llvm-svn: 240831

9 years agoAMDGPU/SI: There are no implicit kernel args in the amdhsa ABI
Tom Stellard [Fri, 26 Jun 2015 21:15:03 +0000 (21:15 +0000)]
AMDGPU/SI: There are no implicit kernel args in the amdhsa ABI

Reviewers: arsenm

Subscribers: llvm-commits

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

llvm-svn: 240830

9 years agoAMDGPU/SI: Emit amd_kernel_code_t in EmitFunctionBodyStart()
Tom Stellard [Fri, 26 Jun 2015 21:14:58 +0000 (21:14 +0000)]
AMDGPU/SI: Emit amd_kernel_code_t in EmitFunctionBodyStart()

Summary:
This way the function symbol points to the start of amd_kernel_code_t
rather than the start of the function.

Reviewers: arsenm

Subscribers: llvm-commits

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

llvm-svn: 240829

9 years agoTeach InlineCost to account for a null check which can be folded away
Philip Reames [Fri, 26 Jun 2015 20:51:17 +0000 (20:51 +0000)]
Teach InlineCost to account for a null check which can be folded away

If we have a caller that knows a particular argument can never be null, we can exploit this fact while simplifying values in the inline cost analysis. This has the effect of reducing the cost for inlining when a null check is present in the callee, but the value is known non null in the caller. In particular, any dependent control flow can be discounted from the cost estimate.

Note that we use the parameter attributes at the call site to memoize the analysis within the caller's code.  The setting of this attribute is done in InstCombine, the inline cost analysis just consumes it.  This is intentional and important because we want the inline cost analysis results to be easily cachable themselves.  We're not currently doing so, but initial results on LTO indicate this will quickly become important.

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

llvm-svn: 240828

9 years agoDataLayout now returns a const ref to its member string representation
Mehdi Amini [Fri, 26 Jun 2015 20:44:16 +0000 (20:44 +0000)]
DataLayout now returns a const ref to its member string representation

There was no particular reason to return by value in the first place.

From: Mehdi Amini <mehdi.amini@apple.com>
llvm-svn: 240826

9 years ago[asan] Link sanitizer_common tests on Android as -pie.
Evgeniy Stepanov [Fri, 26 Jun 2015 20:39:30 +0000 (20:39 +0000)]
[asan] Link sanitizer_common tests on Android as -pie.

llvm-svn: 240825

9 years agoAMDGPU: really don't commute REV opcodes if the target variant doesn't exist
Marek Olsak [Fri, 26 Jun 2015 20:29:10 +0000 (20:29 +0000)]
AMDGPU: really don't commute REV opcodes if the target variant doesn't exist

If pseudoToMCOpcode failed, we would return the original opcode, so operands
would be swapped, but the instruction would remain the same.
It resulted in LSHLREV a, b ---> LSHLREV b, a.

This fixes Glamor text rendering and
piglit/arb_sample_shading-builtin-gl-sample-mask on VI.

This is a candidate for stable branches.

v2: the test was simplified by Tom Stellard
llvm-svn: 240824

9 years agoAdd Value.def to the list of textual includes, excluding it from the modules build.
Benjamin Kramer [Fri, 26 Jun 2015 20:16:44 +0000 (20:16 +0000)]
Add Value.def to the list of textual includes, excluding it from the modules build.

llvm-svn: 240823

9 years agoConvert a bunch of loops to foreach. NFC.
Pete Cooper [Fri, 26 Jun 2015 19:37:02 +0000 (19:37 +0000)]
Convert a bunch of loops to foreach.  NFC.

This uses the new SDNode::op_values() iterator range committed in r240805.

llvm-svn: 240822

9 years agoAdd missing builtins to altivec.h for ABI compliance (vol. 1)
Nemanja Ivanovic [Fri, 26 Jun 2015 19:27:20 +0000 (19:27 +0000)]
Add missing builtins to altivec.h for ABI compliance (vol. 1)

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

This is the first round of additions of missing builtins listed in the ABI document. More to come (this builds onto what seurer already addes). This patch adds:
vector signed long long vec_abs(vector signed long long)
vector double vec_abs(vector double)
vector signed long long vec_add(vector signed long long, vector signed long long)
vector unsigned long long vec_add(vector unsigned long long, vector unsigned long long)
vector double vec_add(vector double, vector double)
vector double vec_and(vector bool long long, vector double)
vector double vec_and(vector double, vector bool long long)
vector double vec_and(vector double, vector double)
vector signed long long vec_and(vector signed long long, vector signed long long)
vector double vec_andc(vector bool long long, vector double)
vector double vec_andc(vector double, vector bool long long)
vector double vec_andc(vector double, vector double)
vector signed long long vec_andc(vector signed long long, vector signed long long)
vector double vec_ceil(vector double)
vector bool long long vec_cmpeq(vector double, vector double)
vector bool long long vec_cmpge(vector double, vector double)
vector bool long long vec_cmpge(vector signed long long, vector signed long long)
vector bool long long vec_cmpge(vector unsigned long long, vector unsigned long long)
vector bool long long vec_cmpgt(vector double, vector double)
vector bool long long vec_cmple(vector double, vector double)
vector bool long long vec_cmple(vector signed long long, vector signed long long)
vector bool long long vec_cmple(vector unsigned long long, vector unsigned long long)
vector bool long long vec_cmplt(vector double, vector double)
vector bool long long vec_cmplt(vector signed long long, vector signed long long)
vector bool long long vec_cmplt(vector unsigned long long, vector unsigned long long)

llvm-svn: 240821

9 years agoAdd missing builtins to the PPC back end for ABI compliance (vol. 1)
Nemanja Ivanovic [Fri, 26 Jun 2015 19:26:53 +0000 (19:26 +0000)]
Add missing builtins to the PPC back end for ABI compliance (vol. 1)

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

This is the back end portion of patch
http://reviews.llvm.org/D10637
It just adds the code gen and intrinsic functions necessary to support that patch to the back end.

llvm-svn: 240820

9 years agoWrap assert loops in #ifndef NDEBUG
Pete Cooper [Fri, 26 Jun 2015 19:23:20 +0000 (19:23 +0000)]
Wrap assert loops in #ifndef NDEBUG

The body of the loops here only contained asserts.  This triggered an unused variable
warning on release builds and -Werror on the bots.

llvm-svn: 240819

9 years agoFix MSVC build.
Peter Collingbourne [Fri, 26 Jun 2015 19:20:09 +0000 (19:20 +0000)]
Fix MSVC build.

llvm-svn: 240818

9 years agoConvert a bunch of loops to foreach. NFC.
Pete Cooper [Fri, 26 Jun 2015 19:18:49 +0000 (19:18 +0000)]
Convert a bunch of loops to foreach.  NFC.

This uses the new SDNode::op_values() iterator range committed in r240805.

llvm-svn: 240817

9 years ago[ASan] Clean up obsolete stats.
Alexey Samsonov [Fri, 26 Jun 2015 19:18:02 +0000 (19:18 +0000)]
[ASan] Clean up obsolete stats.

Remove stats that we no longer collect after the allocator change.
Use proper constant SizeClassMap::kNumClasses to fix potential buffer
overflow (https://code.google.com/p/address-sanitizer/issues/detail?id=397).

llvm-svn: 240816

9 years agoConvert a bunch of loops to foreach. NFC.
Pete Cooper [Fri, 26 Jun 2015 19:08:33 +0000 (19:08 +0000)]
Convert a bunch of loops to foreach.  NFC.

This uses the new SDNode::op_values() iterator range committed in r240805.

llvm-svn: 240815

9 years agoMake header parse standalone. NFC.
Benjamin Kramer [Fri, 26 Jun 2015 19:04:11 +0000 (19:04 +0000)]
Make header parse standalone. NFC.

llvm-svn: 240814

9 years agoShow invariant loads in MMO dumping
Matt Arsenault [Fri, 26 Jun 2015 19:00:11 +0000 (19:00 +0000)]
Show invariant loads in MMO dumping

llvm-svn: 240813

9 years agoCOFF: Implement /lldmap flag.
Peter Collingbourne [Fri, 26 Jun 2015 18:58:24 +0000 (18:58 +0000)]
COFF: Implement /lldmap flag.

This flag can be used to produce a map file, which is essentially a list
of objects linked into the final output file together with the RVAs of
their symbols. Because our format differs from MSVC's we expose it as a
separate flag.

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

llvm-svn: 240812

9 years agoRevert "Revert r240762 "[X86] Cleanup X86WindowsTargetObjectFile::getSectionForConstant""
David Majnemer [Fri, 26 Jun 2015 18:55:48 +0000 (18:55 +0000)]
Revert "Revert r240762 "[X86] Cleanup X86WindowsTargetObjectFile::getSectionForConstant""

This reverts commit r240793 while fixing how we handle array constant
pool entries.

This fixes PR23966.

llvm-svn: 240811

9 years agoFix error handling in getString and simplify callers.
Rafael Espindola [Fri, 26 Jun 2015 18:42:17 +0000 (18:42 +0000)]
Fix error handling in getString and simplify callers.

llvm-svn: 240810

9 years agoConvert a bunch of loops to foreach. NFC.
Pete Cooper [Fri, 26 Jun 2015 18:41:54 +0000 (18:41 +0000)]
Convert a bunch of loops to foreach.  NFC.

This uses the new SDNode::op_values() iterator range committed in r240805.

llvm-svn: 240809

9 years ago[PPC]: Fix bug in getMultiarchTriple.
Douglas Katzman [Fri, 26 Jun 2015 18:37:15 +0000 (18:37 +0000)]
[PPC]: Fix bug in getMultiarchTriple.

And generally prefer not to restate TargetTriple.str() over and over.

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

llvm-svn: 240808

9 years agoDelete dead code. NFC.
Rafael Espindola [Fri, 26 Jun 2015 18:32:53 +0000 (18:32 +0000)]
Delete dead code. NFC.

llvm-svn: 240807

9 years agoCOFF: Align DLL import thunks on 16-byte boundaries.
Rui Ueyama [Fri, 26 Jun 2015 18:28:56 +0000 (18:28 +0000)]
COFF: Align DLL import thunks on 16-byte boundaries.

llvm-svn: 240806

9 years agoAdd op_values() to iterate over the SDValue operands of an SDNode.
Pete Cooper [Fri, 26 Jun 2015 18:17:36 +0000 (18:17 +0000)]
Add op_values() to iterate over the SDValue operands of an SDNode.

SDNode already had ops() which would iterate over the operands and return
SDUse*.  This version instead gets the SDValue's out of the SDUse's so that
we can use foreach in more places.

Reviewed by David Blaikie.

llvm-svn: 240805

9 years agoMove VectorUtils from Transforms to Analysis to correct layering violation
David Blaikie [Fri, 26 Jun 2015 18:02:52 +0000 (18:02 +0000)]
Move VectorUtils from Transforms to Analysis to correct layering violation

llvm-svn: 240804

9 years agoFixed incorrect application of expectedFlakey
Vince Harron [Fri, 26 Jun 2015 18:01:15 +0000 (18:01 +0000)]
Fixed incorrect application of expectedFlakey

llvm-svn: 240803

9 years agoCOFF: Fix README.
Rui Ueyama [Fri, 26 Jun 2015 17:59:12 +0000 (17:59 +0000)]
COFF: Fix README.

llvm-svn: 240802

9 years agoAvoid false positive/negative test results from line directive interference.NFC.
Chad Rosier [Fri, 26 Jun 2015 17:49:10 +0000 (17:49 +0000)]
Avoid false positive/negative test results from line directive interference.NFC.

http://reviews.llvm.org/D10443
Patch by Geoff Berry.

llvm-svn: 240801

9 years ago[static analyzer] Analyzer is skipping forward declared C/C++ functions
Anna Zaks [Fri, 26 Jun 2015 17:42:58 +0000 (17:42 +0000)]
[static analyzer] Analyzer is skipping forward declared C/C++ functions

A patch by Karthik Bhat!

This patch fixes a regression introduced by r224398. Prior to r224398
we were able to analyze the following code in test-include.c and report
a null deref in this case. But post r224398 this analysis is being skipped.

E.g.
  // test-include.c
  #include "test-include.h"
  void test(int * data) {
    data = 0;
    *data = 1;
  }

   // test-include.h
  void test(int * data);

This patch uses the function body (instead of its declaration) as the location
of the function when deciding if the Decl should be analyzed with path-sensitive
analysis. (Prior to r224398, the call graph was guaranteed to have a definition
when available.)

llvm-svn: 240800

9 years ago[ARM] Cortex-R5 is not VFPOnlySP
Javed Absar [Fri, 26 Jun 2015 17:42:37 +0000 (17:42 +0000)]
[ARM] Cortex-R5 is not VFPOnlySP

This patch fixes the error in ARM.td which stated that Cortex-R5
floating point unit can do only single precision, when it can do double as well.

Reviewers: rengolin

Subscribers: llvm-commits

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

llvm-svn: 240799

9 years ago[LAA] Try to prove non-wrapping of pointers if SCEV cannot
Adam Nemet [Fri, 26 Jun 2015 17:25:43 +0000 (17:25 +0000)]
[LAA] Try to prove non-wrapping of pointers if SCEV cannot

Summary:
Scalar evolution does not propagate the non-wrapping flags to values
that are derived from a non-wrapping induction variable because
the non-wrapping property could be flow-sensitive.

This change is a first attempt to establish the non-wrapping property in
some simple cases.  The main idea is to look through the operations
defining the pointer.  As long as we arrive to a non-wrapping AddRec via
a small chain of non-wrapping instruction, the pointer should not wrap
either.

I believe that this essentially is what Andy described in
http://article.gmane.org/gmane.comp.compilers.llvm.cvs/220731 as the way
forward.

Reviewers: aschwaighofer, nadav, sanjoy, atrick

Reviewed By: atrick

Subscribers: llvm-commits

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

llvm-svn: 240798

9 years agoFix unused variable from r240792.
Alex Lorenz [Fri, 26 Jun 2015 17:07:27 +0000 (17:07 +0000)]
Fix unused variable from r240792.

The variable 'I' wasn't used when assertions were disabled.
This commit ensures that 'I' is used outside of an assert.

llvm-svn: 240797

9 years ago[DAGCombine] Fix demanded bits computation for exact shifts.
Benjamin Kramer [Fri, 26 Jun 2015 16:59:31 +0000 (16:59 +0000)]
[DAGCombine] Fix demanded bits computation for exact shifts.

Fixes a miscompilation of MultiSource/Benchmarks/MallocBench/gs

llvm-svn: 240796