[FastISel][ARM] Do not emit stores for undef arguments.

This is a followup patch for r214366, which added the same behavior to the
AArch64 and X86 FastISel code. This fix reproduces the already existing
behavior of SelectionDAG in FastISel.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@214531 91177308-0d34-0410-b5e6-96231b3b80d8
Replace comment about ownership with std::unique_ptr.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@214533 91177308-0d34-0410-b5e6-96231b3b80d8
Explicitly report runtime stack realignment in StackMap section

This change adds code to explicitly mark a function which requires runtime stack realignment as not having a fixed frame size in the StackMap section. As it happens, this is not actually a functional change. The size that would be reported without the check is also "-1", but as far as I can tell, that's an accident. The code change makes this explicit.

Note: There's a separate bug in handling of stackmaps and patchpoints in functions which need dynamic frame realignment. The current code assumes that offsets can be calculated from RBP, but realigned frames must use RSP. (There's a variable gap between RBP and the spill slots.) This change set does not address that issue.

Reviewers: atrick, ributzka

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




git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@214534 91177308-0d34-0410-b5e6-96231b3b80d8
Use object::Archive::create instead of new object::Archive.

Also fix the error handling. No testcaes, issue found by inspection.

Thanks to David Blaikie for the suggestion.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@214535 91177308-0d34-0410-b5e6-96231b3b80d8
[FastISel][AArch64] Add branch weights.

Add branch weights to branch instructions, so that the following passes can
optimize based on it (i.e. basic block ordering).

Fixes <rdar://problem/17887137>.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@214537 91177308-0d34-0410-b5e6-96231b3b80d8
Add support for StackMap section for ELF/Linux systems

This patch adds code to emits the StackMap section on ELF systems. This section is required to support llvm.experimental.stackmap and llvm.experimental.patchpoint intrinsics.

Reviewers: ributzka, echristo

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



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@214538 91177308-0d34-0410-b5e6-96231b3b80d8
Move virtual method out of line.

Should fix the MSVC build.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@214539 91177308-0d34-0410-b5e6-96231b3b80d8
Fix building with in-tree libc++abi on FreeBSD
Differential Revision: http://reviews.llvm.org/D4743


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

MSVC was complaining about Archive being an incomplete type.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@214542 91177308-0d34-0410-b5e6-96231b3b80d8
[FastISel][AArch64] Fold offset into the memory operation.

Fold simple offsets into the memory operation:
  add x0, x0, #8
  ldr x0, [x0]
-->
  ldr x0, [x0, #8]

Fixes <rdar://problem/17887945>.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@214545 91177308-0d34-0410-b5e6-96231b3b80d8
[SDAG] Begin simplifying the way in which the legalizer deletes nodes.

This lifts the (very few) places the legalizer would delete dead nodes
into the outer loop around the legalizer. This is significantly simpler
because it doesn't require the legalizer itself to manage the iterator
validity, and it doesn't require the legalizer to be a DAG update
listener in order to remove things from the legalized set. It also makes
the interface much less contrived for the case of the legalizer running
inside the last phase of DAG combining.

I'm working on centralizing the deletion of nodes during both legalizing
and combining as much as possible. My hope is to remove the need for DAG
update listeners from the combiner next, which would remove a costly
virtual dispatch chain on every deletion. This in turn should allow us
to more aggressively delete DAG nodes during combining which will in
turn allow us to combine more aggressively by exposing the actual nodes
which have single users to the combine phases.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@214546 91177308-0d34-0410-b5e6-96231b3b80d8
llvm-profdata: Replace redundant tests with more targeted ones

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@214548 91177308-0d34-0410-b5e6-96231b3b80d8
MS inline asm: Use memory constraints for functions instead of registers

This is consistent with how we parse them in a standalone .s file, and
inline assembly shouldn't differ.

This fixes errors about requiring more registers than available in
cases like this:
  void f();
  void __declspec(naked) g() {
    __asm pusha
    __asm call f
    __asm popa
    __asm ret
  }

There are no registers available to pass the address of 'f' into the asm
blob.  The asm should now directly call 'f'.

Tests will land in Clang shortly.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@214550 91177308-0d34-0410-b5e6-96231b3b80d8
Rewrite BitReaderTest, NFC

Rewrite the single unit test in `BitReaderTest` so that it's easier to
add more tests.

  - Parse from an assembly string rather than using API.
  - Use more helper functions.
  - Use a separate context for the module on the other side.

Aside from relying on the assembly parser, there's no functionality
change intended.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@214556 91177308-0d34-0410-b5e6-96231b3b80d8
Try to fix configure+make after r214556

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@214558 91177308-0d34-0410-b5e6-96231b3b80d8
BitcodeReader: Fix some BlockAddress forward reference corner cases

`BlockAddress`es are interesting in that they can reference basic blocks
from *outside* the block's function.  Since basic blocks are not global
values, this presents particular challenges for lazy parsing.

One corner case was found in PR11677 and fixed in r147425.  In that
case, a global variable references a block address.  It's necessary to
load the relevant function to resolve the forward reference before doing
anything with the module.

By inspection, I found (and have fixed here) two other cases:

  - An instruction from one function references a block address from
    another function, and only the first function is lazily loaded.

    I fixed this the same way as PR11677: by eagerly loading the
    referenced function.

  - A function whose block address is taken is dematerialized, leaving
    invalid references to it.

    I fixed this by refusing to dematerialize functions whose block
    addresses are taken (if you have to load it, you can't unload it).

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@214559 91177308-0d34-0410-b5e6-96231b3b80d8
Add a non-const subtarget returning function to the target machine
so that we can use it to get the old-style JIT out of the subtarget.

This code should be removed when the old-style JIT is removed
(imminently).

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@214560 91177308-0d34-0410-b5e6-96231b3b80d8
[dfsan] Correctly handle loads and stores of zero size.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@214561 91177308-0d34-0410-b5e6-96231b3b80d8
IR: Add BasicBlock::insertInto()

Although unlinked `BasicBlock`s can be created, there's currently no way
to insert them into `Function`s after the fact.  In particular,
`moveAfter()` and `moveBefore()` require that the basic block is already
linked.

Extract the logic for initially linking a `BasicBlock` out of the
constructor and into a member function that can be used for lazy
insertion.

  - Asserts that the basic block is currently unlinked.
  - Matches the logic of the constructor.
  - Changed the constructor to use it since the logic matches.

This is needed in a follow-up commit for PR5680.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@214563 91177308-0d34-0410-b5e6-96231b3b80d8
docs: Strongly recommend setting rpath when using a local GCC toolchain

Users keep emailing us about the difficulties of getting LD_LIBRARY_PATH
into their environment, which should be completely unecessary. Try to
strengthen the rpath recommentation by putting in an example cmake
invocation.

Speaking of which, we might want to make CMake the recommended build
system in GettingStarted.html.

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