DIEEntry: Refer to the specified DIE via reference rather than pointer.

Makes some more cases (the unit tests, specifically), lexically
compatible with a change to unique_ptr.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@207261 91177308-0d34-0410-b5e6-96231b3b80d8
DIE: Pass ownership of children via std::unique_ptr rather than raw pointer.

This should reduce the chance of memory leaks like those fixed in
r207240.

There's still some unclear ownership of DIEs happening in DwarfDebug.
Pushing unique_ptr and references through more APIs should help expose
the cases where ownership is a bit fuzzy.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@207263 91177308-0d34-0410-b5e6-96231b3b80d8
DwarfUnit: Remove unused function

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@207264 91177308-0d34-0410-b5e6-96231b3b80d8
BugPoint: Fix some memory leaks.

Patch by Kostya Serebryany.

unique_ptr would be nice, but it's a bit too much work for an area I'm
not familiar with, nor invested in, unfortunately.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@207265 91177308-0d34-0410-b5e6-96231b3b80d8
MCAssembler: Simplify implementation of const variants of getSymbolData by calling one implementation from the other.

Code review feedback by Rafael Espindola on r207124.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@207266 91177308-0d34-0410-b5e6-96231b3b80d8
This reapplies r207235 with an additional bugfixes caught by the msan
buildbot - do not insert debug intrinsics before phi nodes.

Debug info for optimized code: Support variables that are on the stack and
described by DBG_VALUEs during their lifetime.

Previously, when a variable was at a FrameIndex for any part of its
lifetime, this would shadow all other DBG_VALUEs and only a single
fbreg location would be emitted, which in fact is only valid for a small
range and not the entire lexical scope of the variable. The included
dbg-value-const-byref testcase demonstrates this.

This patch fixes this by
Local
- emitting dbg.value intrinsics for allocas that are passed by reference
- dropping all dbg.declares (they are now fully lowered to dbg.values)
SelectionDAG
- renamed constructors for SDDbgValue for better readability.
- fix UserValue::match() to handle indirect values correctly
- not inserting an MMI table entries for dbg.values that describe allocas.
- lowering dbg.values that describe allocas into *indirect* DBG_VALUEs.
CodeGenPrepare
- leaving dbg.values for an alloca were they are (see comment)
Other
- regenerated/updated instcombine.ll testcase and included source

rdar://problem/16679879
http://reviews.llvm.org/D3374

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@207269 91177308-0d34-0410-b5e6-96231b3b80d8
SCC: Use the reference typedef

Actually use the `reference` typedef, and remove the private
redefinition of `pointer` since it has no users.

Using `reference` exposes a problem with r207257, which specified the
wrong `value_type` to `iterator_facade_base` (fixed that too).

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