Fix most of PR10367.

This patch changes the design of GlobalAlias so that it doesn't take a
ConstantExpr anymore. It now points directly to a GlobalObject, but its type is
independent of the aliasee type.

To avoid changing all alias related tests in this patches, I kept the common
syntax

@foo = alias i32* @bar

to mean the same as now. The cases that used to use cast now use the more
general syntax

@foo = alias i16, i32* @bar.

Note that GlobalAlias now behaves a bit more like GlobalVariable. We
know that its type is always a pointer, so we omit the '*'.

For the bitcode, a nice surprise is that we were writing both identical types
already, so the format change is minimal. Auto upgrade is handled by looking
through the casts and no new fields are needed for now. New bitcode will
simply have different types for Alias and Aliasee.

One last interesting point in the patch is that replaceAllUsesWith becomes
smart enough to avoid putting a ConstantExpr in the aliasee. This seems better
than checking and updating every caller.

A followup patch will delete getAliasedGlobal now that it is redundant. Another
patch will add support for an explicit offset.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@209007 91177308-0d34-0410-b5e6-96231b3b80d8
DebugInfo: Add an assert regarding the subprogram in the subprogram map matching the abstract subprogram.

I'm not sure this is how it'll be going forward (I'd rather prefer the
definition to be in the main SP mapping, for various reasons) but this
helps me understand how it is today.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@209009 91177308-0d34-0410-b5e6-96231b3b80d8
Fix a warning in builds without asserts.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@209012 91177308-0d34-0410-b5e6-96231b3b80d8
Add comdat key field to llvm.global_ctors and llvm.global_dtors

This allows us to put dynamic initializers for weak data into the same
comdat group as the data being initialized.  This is necessary for MSVC
ABI compatibility.  Once we have comdats for guard variables, we can use
the combination to help GlobalOpt fire more often for weak data with
guarded initialization on other platforms.

Reviewers: nlewycky

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@209015 91177308-0d34-0410-b5e6-96231b3b80d8
R600/SI: Remove duplicate pattern

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@209023 91177308-0d34-0410-b5e6-96231b3b80d8
R600/SI: Promote f32 SELECT to i32

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@209024 91177308-0d34-0410-b5e6-96231b3b80d8
R600/SI: Remove unused instruction

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@209025 91177308-0d34-0410-b5e6-96231b3b80d8
R600/SI: Move tablegen patterns away from instruction defs

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@209026 91177308-0d34-0410-b5e6-96231b3b80d8
R600/SI: Add a PredicateControl class for managing TableGen predicates

This was inspired by the PredicateControl class in the MIPS backend.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@209027 91177308-0d34-0410-b5e6-96231b3b80d8
R600/SI: Refactor the VOP3_32 tablegen class

This will allow us to use a single MachineInstr to represent
instructions which behave the same but have different encodings
on some subtargets.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@209028 91177308-0d34-0410-b5e6-96231b3b80d8
DebugInfo: Handle emitting constants of C++ unicode character type.

Patch by Stephan Tolksdorf! (with some test case stuff by me)

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@209037 91177308-0d34-0410-b5e6-96231b3b80d8
DebugInfo: Assert rather than conditionalizing when a CU's subprogram list contains declarations.

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@209040 91177308-0d34-0410-b5e6-96231b3b80d8
Implemented LowerVSELECT to custom lower some instructions.

No functionality change intended. The types that previously were set to
lower as Expand or Legal are doing the same thing with this lowering
function.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@209042 91177308-0d34-0410-b5e6-96231b3b80d8
Lower vselects into X86ISD::BLENDI when appropriate.

LowerVSELECT will, if possible, generate a X86ISD::BLENDI DAG node if the
condition is constant and we can emit that instruction, given the
subtarget.

This is not enough for all cases. An additional SELECTCombine optimization
will be committed.

Fixed tests that were expecting variable blends but where a blend+imm can
be generated.
Added test where we can't emit blend+immediate.
Added avx2 blend+imm tests.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@209043 91177308-0d34-0410-b5e6-96231b3b80d8
Implemented special cases for PerformVSELECTCombine.

vselects with constant masks, after legalization, will get turned into
specialized shuffle_vectors so they can be matched to blend+imm
instructions.

Fixed some tests.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@209044 91177308-0d34-0410-b5e6-96231b3b80d8
Added tests for the cost of lowering VSELECT instructions.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@209045 91177308-0d34-0410-b5e6-96231b3b80d8
Use a sized enum for MachineOperandType.  No functionality change

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@209048 91177308-0d34-0410-b5e6-96231b3b80d8
Add support for combining GEPs across PHI nodes

Currently LLVM will generally merge GEPs. This allows backends to use more
complex addressing modes. In some cases this is not happening because there
is PHI inbetween the two GEPs:

  GEP1--\
        |-->PHI1-->GEP3
  GEP2--/

This patch checks to see if GEP1 and GEP2 are similiar enough that they can be
cloned (GEP12) in GEP3's BB, allowing GEP->GEP merging (GEP123):

  GEP1--\                     --\                           --\
        |-->PHI1-->GEP3  ==>    |-->PHI2->GEP12->GEP3 == >    |-->PHI2->GEP123
  GEP2--/                     --/                           --/

This also breaks certain use chains that are preventing GEP->GEP merges that the
the existing instcombine would merge otherwise.

Tests included.

rdar://15547484

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@209049 91177308-0d34-0410-b5e6-96231b3b80d8
[DWARF parser] Teach DIContext to fetch short (non-linkage) function names for a given address.

Change --functions option in llvm-symbolizer tool to accept
values "none", "short" or "linkage". Update the tests and docs
accordingly.


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