Allow global address space forward decls using IDs in .ll files.

Summary:
This fixes bugzilla bug 24656. Fixes the case where there is a forward
reference to a global variable using an ID (i.e. @0). It does this by
passing the address space of the initializer pointer for which the
forward referenced global is used.

llvm-svn: 246788
diff --git a/llvm/test/Assembler/global-addrspace-forwardref.ll b/llvm/test/Assembler/global-addrspace-forwardref.ll
index 4a036e0..c66b5b7 100644
--- a/llvm/test/Assembler/global-addrspace-forwardref.ll
+++ b/llvm/test/Assembler/global-addrspace-forwardref.ll
@@ -7,3 +7,12 @@
 ; CHECK: @a = addrspace(1) global i8 0
 @a2 = global i8 addrspace(1)* @a
 @a = addrspace(1) global i8 0
+
+; Now test with global IDs instead of global names.
+
+; CHECK: @a3 = global i8 addrspace(1)* @0
+; CHECK: @0 = addrspace(1) global i8 0
+
+@a3 = global i8 addrspace(1)* @0
+@0 = addrspace(1) global i8 0
+