llvm.org GIT mirror llvm / 21f77df
[opaque pointer type] Add textual IR support for explicit type parameter for global aliases update.py: import fileinput import sys import re alias_match_prefix = r"(.*(?:=|:|^)\s*(?:external |)(?:(?:private|internal|linkonce|linkonce_odr|weak|weak_odr|common|appending|extern_weak|available_externally) )?(?:default |hidden |protected )?(?:dllimport |dllexport )?(?:unnamed_addr |)(?:thread_local(?:\([a-z]*\))? )?alias" plain = re.compile(alias_match_prefix + r" (.*?))(| addrspace\(\d+\) *)\*($| *(?:%|@|null|undef|blockaddress|addrspacecast|\[\[[a-zA-Z]|\{\{).*$)") cast = re.compile(alias_match_prefix + r") ((?:bitcast|inttoptr|addrspacecast)\s*\(.* to (.*?)(| addrspace\(\d+\) *)\*\)\s*(?:;.*)?$)") gep = re.compile(alias_match_prefix + r") ((?:getelementptr)\s*(?:inbounds)?\s*\((?P<type>.*), (?P=type)(?:\s*addrspace\(\d+\)\s*)?\* .*\)\s*(?:;.*)?$)") def conv(line): m = re.match(cast, line) if m: return m.group(1) + " " + m.group(3) + ", " + m.group(2) m = re.match(gep, line) if m: return m.group(1) + " " + m.group(3) + ", " + m.group(2) m = re.match(plain, line) if m: return m.group(1) + ", " + m.group(2) + m.group(3) + "*" + m.group(4) + "\n" return line for line in sys.stdin: sys.stdout.write(conv(line)) apply.sh: for name in "$@" do python3 `dirname "$0"`/update.py < "$name" > "$name.tmp" && mv "$name.tmp" "$name" rm -f "$name.tmp" done The actual commands: From llvm/src: find test/ -name *.ll | xargs ./apply.sh From llvm/src/tools/clang: find test/ -name *.mm -o -name *.m -o -name *.cpp -o -name *.c | xargs -I '{}' ../../apply.sh "{}" From llvm/src/tools/polly: find test/ -name *.ll | xargs ./apply.sh git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@247378 91177308-0d34-0410-b5e6-96231b3b80d8 David Blaikie 3 years ago
116 changed file(s) with 493 addition(s) and 474 deletion(s). Raw diff Collapse all Expand all
677677 return Error(NameLoc,
678678 "symbol with local linkage must have default visibility");
679679
680 Type *Ty;
681 LocTy ExplicitTypeLoc = Lex.getLoc();
682 if (ParseType(Ty) ||
683 ParseToken(lltok::comma, "expected comma after alias's type"))
684 return true;
685
680686 Constant *Aliasee;
681687 LocTy AliaseeLoc = Lex.getLoc();
682688 if (Lex.getKind() != lltok::kw_bitcast &&
699705 auto *PTy = dyn_cast(AliaseeType);
700706 if (!PTy)
701707 return Error(AliaseeLoc, "An alias must have pointer type");
708
709 if (Ty != PTy->getElementType())
710 return Error(
711 ExplicitTypeLoc,
712 "explicit pointee type doesn't match operand's pointee type");
702713
703714 // Okay, create the alias but do not insert it into the module yet.
704715 std::unique_ptr GA(
24082408
24092409 Out << "alias ";
24102410
2411 TypePrinter.print(GA->getValueType(), Out);
2412
2413 Out << ", ";
2414
24112415 const Constant *Aliasee = GA->getAliasee();
24122416
24132417 if (!Aliasee) {
88 %struct.usb_hcd = type { %struct.usb_bus, i64, [0 x i64] }
99 @uhci_pci_ids = constant [1 x %struct.pci_device_id] zeroinitializer
1010
11 @__mod_pci_device_table = alias [1 x %struct.pci_device_id]* @uhci_pci_ids
11 @__mod_pci_device_table = alias [1 x %struct.pci_device_id], [1 x %struct.pci_device_id]* @uhci_pci_ids
1212 ; <[1 x %struct.pci_device_id]*> [#uses=0]
1313
1414 define i32 @uhci_suspend(%struct.usb_hcd* %hcd) {
88 %struct.usb_hcd = type { %struct.usb_bus, [0 x i64] }
99 @pci_ids = constant [1 x %struct.pci_device_id] zeroinitializer
1010
11 @__mod_pci_device_table = alias [1 x %struct.pci_device_id]* @pci_ids ; <[1 x %struct.pci_device_id]*> [#uses=0]
11 @__mod_pci_device_table = alias [1 x %struct.pci_device_id], [1 x %struct.pci_device_id]* @pci_ids ; <[1 x %struct.pci_device_id]*> [#uses=0]
1212
1313 define i32 @ehci_pci_setup(%struct.usb_hcd* %hcd) {
1414 entry:
22 ; PR1645
33
44 @__gthread_active_ptr.5335 = internal constant i8* bitcast (i32 (i32)* @__gthrw_pthread_cancel to i8*)
5 @__gthrw_pthread_cancel = weak alias i32 (i32)* @pthread_cancel
5 @__gthrw_pthread_cancel = weak alias i32 (i32), i32 (i32)* @pthread_cancel
66
77
88
4242 @empty.cmp = global i1 icmp eq ([0 x i8]* @empty.1, [0 x i8]* @empty.2)
4343
4444 ; Don't add an inbounds on @glob.a3, since it's not inbounds.
45 ; CHECK: @glob.a3 = alias getelementptr (i32, i32* @glob.a2, i32 1)
45 ; CHECK: @glob.a3 = alias i32, getelementptr (i32, i32* @glob.a2, i32 1)
4646 @glob = global i32 0
47 @glob.a3 = alias getelementptr (i32, i32* @glob.a2, i32 1)
48 @glob.a2 = alias getelementptr (i32, i32* @glob.a1, i32 1)
49 @glob.a1 = alias i32* @glob
47 @glob.a3 = alias i32, getelementptr (i32, i32* @glob.a2, i32 1)
48 @glob.a2 = alias i32, getelementptr (i32, i32* @glob.a1, i32 1)
49 @glob.a1 = alias i32, i32* @glob
33 ; Test that global aliases are allowed to be constant addrspacecast
44
55 @i = internal addrspace(1) global i8 42
6 @ia = internal alias addrspacecast (i8 addrspace(1)* @i to i8 addrspace(2)* addrspace(3)*)
7 ; CHECK: @ia = internal alias addrspacecast (i8 addrspace(2)* addrspace(1)* bitcast (i8 addrspace(1)* @i to i8 addrspace(2)* addrspace(1)*) to i8 addrspace(2)* addrspace(3)*)
6 @ia = internal alias i8 addrspace(2)*, addrspacecast (i8 addrspace(1)* @i to i8 addrspace(2)* addrspace(3)*)
7 ; CHECK: @ia = internal alias i8 addrspace(2)*, addrspacecast (i8 addrspace(2)* addrspace(1)* bitcast (i8 addrspace(1)* @i to i8 addrspace(2)* addrspace(1)*) to i8 addrspace(2)* addrspace(3)*)
22 ; CHECK: error: redefinition of global named '@bar'
33
44 @foo = global i32 0
5 @bar = alias i32* @foo
6 @bar = alias i32* @foo
5 @bar = alias i32, i32* @foo
6 @bar = alias i32, i32* @foo
55 @alias.ref2 = global i32* getelementptr inbounds (i32, i32* @alias, i64 1)
66
77 ; Aliases.
8 @alias = alias i32* @global
9 @alias.ref3 = alias i32* getelementptr inbounds (i32, i32* @alias, i64 1)
10 @alias.ref4 = alias i32* getelementptr inbounds (i32, i32* @alias, i64 1)
8 @alias = alias i32, i32* @global
9 @alias.ref3 = alias i32, getelementptr inbounds (i32, i32* @alias, i64 1)
10 @alias.ref4 = alias i32, getelementptr inbounds (i32, i32* @alias, i64 1)
44 target datalayout = "e-p:64:64:64-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f32:32:32-f64:64:64-v64:64:64-v128:128:128-a0:0:64-s0:64:64-f80:128:128"
55 target triple = "x86_64-unknown-linux-gnu"
66
7 @f = alias void ()* @0 ; [#uses=0]
8 @g = alias void ()* @1 ; [#uses=0]
7 @f = alias void (), void ()* @0 ; [#uses=0]
8 @g = alias void (), void ()* @1 ; [#uses=0]
99 @h = external global void ()* ; [#uses=0]
1010
1111 define internal void @0() nounwind {
11
22 @global = global i32 0
33
4 @alias = internal hidden alias i32* @global
4 @alias = internal hidden alias i32, i32* @global
55 ; CHECK: symbol with local linkage must have default visibility
11
22 @global = global i32 0
33
4 @alias = internal protected alias i32* @global
4 @alias = internal protected alias i32, i32* @global
55 ; CHECK: symbol with local linkage must have default visibility
0 ; RUN: not llvm-as < %s 2>&1 | FileCheck %s
1 ; CHECK: :4:12: error: explicit pointee type doesn't match operand's pointee type
2 @y = global i2 0
3 @x = alias i1, i2* @y
0 ; RUN: not llvm-as %s -disable-output 2>&1 | grep "forward reference and definition of global have different types"
11
2 @a2 = alias void ()* @g2
2 @a2 = alias void (), void ()* @g2
33 @g2 = internal global i8 42
0 ; RUN: not llvm-as < %s -disable-output 2>&1 | FileCheck %s
11 ; CHECK: error: expected distinct uselistorder indexes in range [0, size)
22 @global = global i32 0
3 @alias1 = alias i32* @global
4 @alias2 = alias i32* @global
5 @alias3 = alias i32* @global
3 @alias1 = alias i32, i32* @global
4 @alias2 = alias i32, i32* @global
5 @alias3 = alias i32, i32* @global
66 uselistorder i32* @global, { 0, 0, 2 }
0 ; RUN: not llvm-as < %s -disable-output 2>&1 | FileCheck %s
11 ; CHECK: error: value only has one use
22 @global = global i32 0
3 @alias = alias i32* @global
3 @alias = alias i32, i32* @global
44 uselistorder i32* @global, { 1, 0 }
0 ; RUN: not llvm-as < %s -disable-output 2>&1 | FileCheck %s
11 ; CHECK: error: expected uselistorder indexes to change the order
22 @global = global i32 0
3 @alias1 = alias i32* @global
4 @alias2 = alias i32* @global
5 @alias3 = alias i32* @global
3 @alias1 = alias i32, i32* @global
4 @alias2 = alias i32, i32* @global
5 @alias3 = alias i32, i32* @global
66 uselistorder i32* @global, { 0, 1, 2 }
0 ; RUN: not llvm-as < %s -disable-output 2>&1 | FileCheck %s
11 ; CHECK: error: expected distinct uselistorder indexes in range [0, size)
22 @global = global i32 0
3 @alias1 = alias i32* @global
4 @alias2 = alias i32* @global
5 @alias3 = alias i32* @global
3 @alias1 = alias i32, i32* @global
4 @alias2 = alias i32, i32* @global
5 @alias3 = alias i32, i32* @global
66 uselistorder i32* @global, { 0, 3, 1 }
0 ; RUN: not llvm-as < %s -disable-output 2>&1 | FileCheck %s
11 ; CHECK: error: wrong number of indexes, expected 3
22 @global = global i32 0
3 @alias1 = alias i32* @global
4 @alias2 = alias i32* @global
5 @alias3 = alias i32* @global
3 @alias1 = alias i32, i32* @global
4 @alias2 = alias i32, i32* @global
5 @alias3 = alias i32, i32* @global
66 uselistorder i32* @global, { 1, 0 }
0 ; RUN: not llvm-as < %s -disable-output 2>&1 | FileCheck %s
11 ; CHECK: error: wrong number of indexes, expected 2
22 @global = global i32 0
3 @alias1 = alias i32* @global
4 @alias2 = alias i32* @global
3 @alias1 = alias i32, i32* @global
4 @alias2 = alias i32, i32* @global
55 uselistorder i32* @global, { 1, 0, 2 }
11
22 @global = global i32 0
33
4 @alias = private hidden alias i32* @global
4 @alias = private hidden alias i32, i32* @global
55 ; CHECK: symbol with local linkage must have default visibility
11
22 @global = global i32 0
33
4 @alias = private protected alias i32* @global
4 @alias = private protected alias i32, i32* @global
55 ; CHECK: symbol with local linkage must have default visibility
44 @1 = private constant i32 1
55 ; CHECK: @1 = private constant i32 1
66
7 @2 = private alias i32* @0
8 ; CHECK: @2 = private alias i32* @0
9 @3 = private alias i32* @1
10 ; CHECK: @3 = private alias i32* @1
7 @2 = private alias i32, i32* @0
8 ; CHECK: @2 = private alias i32, i32* @0
9 @3 = private alias i32, i32* @1
10 ; CHECK: @3 = private alias i32, i32* @1
33 ; RUN: verify-uselistorder < %s
44
55 @a = global [4 x i1] [i1 0, i1 1, i1 0, i1 1]
6 @b = alias getelementptr ([4 x i1], [4 x i1]* @a, i64 0, i64 2)
6 @b = alias i1, getelementptr ([4 x i1], [4 x i1]* @a, i64 0, i64 2)
77
88 ; Check use-list order of constants used by globals.
99 @glob1 = global i5 7
173173 ; [unnamed_addr] alias @
174174
175175 ; Aliases -- Linkage
176 @a.private = private alias i32* @g.private
177 ; CHECK: @a.private = private alias i32* @g.private
178 @a.internal = internal alias i32* @g.internal
179 ; CHECK: @a.internal = internal alias i32* @g.internal
180 @a.linkonce = linkonce alias i32* @g.linkonce
181 ; CHECK: @a.linkonce = linkonce alias i32* @g.linkonce
182 @a.weak = weak alias i32* @g.weak
183 ; CHECK: @a.weak = weak alias i32* @g.weak
184 @a.linkonce_odr = linkonce_odr alias i32* @g.linkonce_odr
185 ; CHECK: @a.linkonce_odr = linkonce_odr alias i32* @g.linkonce_odr
186 @a.weak_odr = weak_odr alias i32* @g.weak_odr
187 ; CHECK: @a.weak_odr = weak_odr alias i32* @g.weak_odr
188 @a.external = external alias i32* @g1
189 ; CHECK: @a.external = alias i32* @g1
176 @a.private = private alias i32, i32* @g.private
177 ; CHECK: @a.private = private alias i32, i32* @g.private
178 @a.internal = internal alias i32, i32* @g.internal
179 ; CHECK: @a.internal = internal alias i32, i32* @g.internal
180 @a.linkonce = linkonce alias i32, i32* @g.linkonce
181 ; CHECK: @a.linkonce = linkonce alias i32, i32* @g.linkonce
182 @a.weak = weak alias i32, i32* @g.weak
183 ; CHECK: @a.weak = weak alias i32, i32* @g.weak
184 @a.linkonce_odr = linkonce_odr alias i32, i32* @g.linkonce_odr
185 ; CHECK: @a.linkonce_odr = linkonce_odr alias i32, i32* @g.linkonce_odr
186 @a.weak_odr = weak_odr alias i32, i32* @g.weak_odr
187 ; CHECK: @a.weak_odr = weak_odr alias i32, i32* @g.weak_odr
188 @a.external = external alias i32, i32* @g1
189 ; CHECK: @a.external = alias i32, i32* @g1
190190
191191 ; Aliases -- Visibility
192 @a.default = default alias i32* @g.default
193 ; CHECK: @a.default = alias i32* @g.default
194 @a.hidden = hidden alias i32* @g.hidden
195 ; CHECK: @a.hidden = hidden alias i32* @g.hidden
196 @a.protected = protected alias i32* @g.protected
197 ; CHECK: @a.protected = protected alias i32* @g.protected
192 @a.default = default alias i32, i32* @g.default
193 ; CHECK: @a.default = alias i32, i32* @g.default
194 @a.hidden = hidden alias i32, i32* @g.hidden
195 ; CHECK: @a.hidden = hidden alias i32, i32* @g.hidden
196 @a.protected = protected alias i32, i32* @g.protected
197 ; CHECK: @a.protected = protected alias i32, i32* @g.protected
198198
199199 ; Aliases -- DLLStorageClass
200 @a.dlldefault = default alias i32* @g.dlldefault
201 ; CHECK: @a.dlldefault = alias i32* @g.dlldefault
202 @a.dllimport = dllimport alias i32* @g1
203 ; CHECK: @a.dllimport = dllimport alias i32* @g1
204 @a.dllexport = dllexport alias i32* @g.dllexport
205 ; CHECK: @a.dllexport = dllexport alias i32* @g.dllexport
200 @a.dlldefault = default alias i32, i32* @g.dlldefault
201 ; CHECK: @a.dlldefault = alias i32, i32* @g.dlldefault
202 @a.dllimport = dllimport alias i32, i32* @g1
203 ; CHECK: @a.dllimport = dllimport alias i32, i32* @g1
204 @a.dllexport = dllexport alias i32, i32* @g.dllexport
205 ; CHECK: @a.dllexport = dllexport alias i32, i32* @g.dllexport
206206
207207 ; Aliases -- ThreadLocal
208 @a.notthreadlocal = alias i32* @g.notthreadlocal
209 ; CHECK: @a.notthreadlocal = alias i32* @g.notthreadlocal
210 @a.generaldynamic = thread_local alias i32* @g.generaldynamic
211 ; CHECK: @a.generaldynamic = thread_local alias i32* @g.generaldynamic
212 @a.localdynamic = thread_local(localdynamic) alias i32* @g.localdynamic
213 ; CHECK: @a.localdynamic = thread_local(localdynamic) alias i32* @g.localdynamic
214 @a.initialexec = thread_local(initialexec) alias i32* @g.initialexec
215 ; CHECK: @a.initialexec = thread_local(initialexec) alias i32* @g.initialexec
216 @a.localexec = thread_local(localexec) alias i32* @g.localexec
217 ; CHECK: @a.localexec = thread_local(localexec) alias i32* @g.localexec
208 @a.notthreadlocal = alias i32, i32* @g.notthreadlocal
209 ; CHECK: @a.notthreadlocal = alias i32, i32* @g.notthreadlocal
210 @a.generaldynamic = thread_local alias i32, i32* @g.generaldynamic
211 ; CHECK: @a.generaldynamic = thread_local alias i32, i32* @g.generaldynamic
212 @a.localdynamic = thread_local(localdynamic) alias i32, i32* @g.localdynamic
213 ; CHECK: @a.localdynamic = thread_local(localdynamic) alias i32, i32* @g.localdynamic
214 @a.initialexec = thread_local(initialexec) alias i32, i32* @g.initialexec
215 ; CHECK: @a.initialexec = thread_local(initialexec) alias i32, i32* @g.initialexec
216 @a.localexec = thread_local(localexec) alias i32, i32* @g.localexec
217 ; CHECK: @a.localexec = thread_local(localexec) alias i32, i32* @g.localexec
218218
219219 ; Aliases -- unnamed_addr
220 @a.unnamed_addr = unnamed_addr alias i32* @g.unnamed_addr
221 ; CHECK: @a.unnamed_addr = unnamed_addr alias i32* @g.unnamed_addr
220 @a.unnamed_addr = unnamed_addr alias i32, i32* @g.unnamed_addr
221 ; CHECK: @a.unnamed_addr = unnamed_addr alias i32, i32* @g.unnamed_addr
222222
223223 ;; Functions
224224 ; Format: define [linkage] [visibility] [DLLStorageClass]
173173 ; [unnamed_addr] alias @
174174
175175 ; Aliases -- Linkage
176 @a.private = private alias i32* @g.private
177 ; CHECK: @a.private = private alias i32* @g.private
178 @a.internal = internal alias i32* @g.internal
179 ; CHECK: @a.internal = internal alias i32* @g.internal
180 @a.linkonce = linkonce alias i32* @g.linkonce
181 ; CHECK: @a.linkonce = linkonce alias i32* @g.linkonce
182 @a.weak = weak alias i32* @g.weak
183 ; CHECK: @a.weak = weak alias i32* @g.weak
184 @a.linkonce_odr = linkonce_odr alias i32* @g.linkonce_odr
185 ; CHECK: @a.linkonce_odr = linkonce_odr alias i32* @g.linkonce_odr
186 @a.weak_odr = weak_odr alias i32* @g.weak_odr
187 ; CHECK: @a.weak_odr = weak_odr alias i32* @g.weak_odr
188 @a.external = external alias i32* @g1
189 ; CHECK: @a.external = alias i32* @g1
176 @a.private = private alias i32, i32* @g.private
177 ; CHECK: @a.private = private alias i32, i32* @g.private
178 @a.internal = internal alias i32, i32* @g.internal
179 ; CHECK: @a.internal = internal alias i32, i32* @g.internal
180 @a.linkonce = linkonce alias i32, i32* @g.linkonce
181 ; CHECK: @a.linkonce = linkonce alias i32, i32* @g.linkonce
182 @a.weak = weak alias i32, i32* @g.weak
183 ; CHECK: @a.weak = weak alias i32, i32* @g.weak
184 @a.linkonce_odr = linkonce_odr alias i32, i32* @g.linkonce_odr
185 ; CHECK: @a.linkonce_odr = linkonce_odr alias i32, i32* @g.linkonce_odr
186 @a.weak_odr = weak_odr alias i32, i32* @g.weak_odr
187 ; CHECK: @a.weak_odr = weak_odr alias i32, i32* @g.weak_odr
188 @a.external = external alias i32, i32* @g1
189 ; CHECK: @a.external = alias i32, i32* @g1
190190
191191 ; Aliases -- Visibility
192 @a.default = default alias i32* @g.default
193 ; CHECK: @a.default = alias i32* @g.default
194 @a.hidden = hidden alias i32* @g.hidden
195 ; CHECK: @a.hidden = hidden alias i32* @g.hidden
196 @a.protected = protected alias i32* @g.protected
197 ; CHECK: @a.protected = protected alias i32* @g.protected
192 @a.default = default alias i32, i32* @g.default
193 ; CHECK: @a.default = alias i32, i32* @g.default
194 @a.hidden = hidden alias i32, i32* @g.hidden
195 ; CHECK: @a.hidden = hidden alias i32, i32* @g.hidden
196 @a.protected = protected alias i32, i32* @g.protected
197 ; CHECK: @a.protected = protected alias i32, i32* @g.protected
198198
199199 ; Aliases -- DLLStorageClass
200 @a.dlldefault = default alias i32* @g.dlldefault
201 ; CHECK: @a.dlldefault = alias i32* @g.dlldefault
202 @a.dllimport = dllimport alias i32* @g1
203 ; CHECK: @a.dllimport = dllimport alias i32* @g1
204 @a.dllexport = dllexport alias i32* @g.dllexport
205 ; CHECK: @a.dllexport = dllexport alias i32* @g.dllexport
200 @a.dlldefault = default alias i32, i32* @g.dlldefault
201 ; CHECK: @a.dlldefault = alias i32, i32* @g.dlldefault
202 @a.dllimport = dllimport alias i32, i32* @g1
203 ; CHECK: @a.dllimport = dllimport alias i32, i32* @g1
204 @a.dllexport = dllexport alias i32, i32* @g.dllexport
205 ; CHECK: @a.dllexport = dllexport alias i32, i32* @g.dllexport
206206
207207 ; Aliases -- ThreadLocal
208 @a.notthreadlocal = alias i32* @g.notthreadlocal
209 ; CHECK: @a.notthreadlocal = alias i32* @g.notthreadlocal
210 @a.generaldynamic = thread_local alias i32* @g.generaldynamic
211 ; CHECK: @a.generaldynamic = thread_local alias i32* @g.generaldynamic
212 @a.localdynamic = thread_local(localdynamic) alias i32* @g.localdynamic
213 ; CHECK: @a.localdynamic = thread_local(localdynamic) alias i32* @g.localdynamic
214 @a.initialexec = thread_local(initialexec) alias i32* @g.initialexec
215 ; CHECK: @a.initialexec = thread_local(initialexec) alias i32* @g.initialexec
216 @a.localexec = thread_local(localexec) alias i32* @g.localexec
217 ; CHECK: @a.localexec = thread_local(localexec) alias i32* @g.localexec
208 @a.notthreadlocal = alias i32, i32* @g.notthreadlocal
209 ; CHECK: @a.notthreadlocal = alias i32, i32* @g.notthreadlocal
210 @a.generaldynamic = thread_local alias i32, i32* @g.generaldynamic
211 ; CHECK: @a.generaldynamic = thread_local alias i32, i32* @g.generaldynamic
212 @a.localdynamic = thread_local(localdynamic) alias i32, i32* @g.localdynamic
213 ; CHECK: @a.localdynamic = thread_local(localdynamic) alias i32, i32* @g.localdynamic
214 @a.initialexec = thread_local(initialexec) alias i32, i32* @g.initialexec
215 ; CHECK: @a.initialexec = thread_local(initialexec) alias i32, i32* @g.initialexec
216 @a.localexec = thread_local(localexec) alias i32, i32* @g.localexec
217 ; CHECK: @a.localexec = thread_local(localexec) alias i32, i32* @g.localexec
218218
219219 ; Aliases -- unnamed_addr
220 @a.unnamed_addr = unnamed_addr alias i32* @g.unnamed_addr
221 ; CHECK: @a.unnamed_addr = unnamed_addr alias i32* @g.unnamed_addr
220 @a.unnamed_addr = unnamed_addr alias i32, i32* @g.unnamed_addr
221 ; CHECK: @a.unnamed_addr = unnamed_addr alias i32, i32* @g.unnamed_addr
222222
223223 ;; Functions
224224 ; Format: define [linkage] [visibility] [DLLStorageClass]
175175 ; [unnamed_addr] alias @
176176
177177 ; Aliases -- Linkage
178 @a.private = private alias i32* @g.private
179 ; CHECK: @a.private = private alias i32* @g.private
180 @a.internal = internal alias i32* @g.internal
181 ; CHECK: @a.internal = internal alias i32* @g.internal
182 @a.linkonce = linkonce alias i32* @g.linkonce
183 ; CHECK: @a.linkonce = linkonce alias i32* @g.linkonce
184 @a.weak = weak alias i32* @g.weak
185 ; CHECK: @a.weak = weak alias i32* @g.weak
186 @a.linkonce_odr = linkonce_odr alias i32* @g.linkonce_odr
187 ; CHECK: @a.linkonce_odr = linkonce_odr alias i32* @g.linkonce_odr
188 @a.weak_odr = weak_odr alias i32* @g.weak_odr
189 ; CHECK: @a.weak_odr = weak_odr alias i32* @g.weak_odr
190 @a.external = external alias i32* @g1
191 ; CHECK: @a.external = alias i32* @g1
178 @a.private = private alias i32, i32* @g.private
179 ; CHECK: @a.private = private alias i32, i32* @g.private
180 @a.internal = internal alias i32, i32* @g.internal
181 ; CHECK: @a.internal = internal alias i32, i32* @g.internal
182 @a.linkonce = linkonce alias i32, i32* @g.linkonce
183 ; CHECK: @a.linkonce = linkonce alias i32, i32* @g.linkonce
184 @a.weak = weak alias i32, i32* @g.weak
185 ; CHECK: @a.weak = weak alias i32, i32* @g.weak
186 @a.linkonce_odr = linkonce_odr alias i32, i32* @g.linkonce_odr
187 ; CHECK: @a.linkonce_odr = linkonce_odr alias i32, i32* @g.linkonce_odr
188 @a.weak_odr = weak_odr alias i32, i32* @g.weak_odr
189 ; CHECK: @a.weak_odr = weak_odr alias i32, i32* @g.weak_odr
190 @a.external = external alias i32, i32* @g1
191 ; CHECK: @a.external = alias i32, i32* @g1
192192
193193 ; Aliases -- Visibility
194 @a.default = default alias i32* @g.default
195 ; CHECK: @a.default = alias i32* @g.default
196 @a.hidden = hidden alias i32* @g.hidden
197 ; CHECK: @a.hidden = hidden alias i32* @g.hidden
198 @a.protected = protected alias i32* @g.protected
199 ; CHECK: @a.protected = protected alias i32* @g.protected
194 @a.default = default alias i32, i32* @g.default
195 ; CHECK: @a.default = alias i32, i32* @g.default
196 @a.hidden = hidden alias i32, i32* @g.hidden
197 ; CHECK: @a.hidden = hidden alias i32, i32* @g.hidden
198 @a.protected = protected alias i32, i32* @g.protected
199 ; CHECK: @a.protected = protected alias i32, i32* @g.protected
200200
201201 ; Aliases -- DLLStorageClass
202 @a.dlldefault = default alias i32* @g.dlldefault
203 ; CHECK: @a.dlldefault = alias i32* @g.dlldefault
204 @a.dllimport = dllimport alias i32* @g1
205 ; CHECK: @a.dllimport = dllimport alias i32* @g1
206 @a.dllexport = dllexport alias i32* @g.dllexport
207 ; CHECK: @a.dllexport = dllexport alias i32* @g.dllexport
202 @a.dlldefault = default alias i32, i32* @g.dlldefault
203 ; CHECK: @a.dlldefault = alias i32, i32* @g.dlldefault
204 @a.dllimport = dllimport alias i32, i32* @g1
205 ; CHECK: @a.dllimport = dllimport alias i32, i32* @g1
206 @a.dllexport = dllexport alias i32, i32* @g.dllexport
207 ; CHECK: @a.dllexport = dllexport alias i32, i32* @g.dllexport
208208
209209 ; Aliases -- ThreadLocal
210 @a.notthreadlocal = alias i32* @g.notthreadlocal
211 ; CHECK: @a.notthreadlocal = alias i32* @g.notthreadlocal
212 @a.generaldynamic = thread_local alias i32* @g.generaldynamic
213 ; CHECK: @a.generaldynamic = thread_local alias i32* @g.generaldynamic
214 @a.localdynamic = thread_local(localdynamic) alias i32* @g.localdynamic
215 ; CHECK: @a.localdynamic = thread_local(localdynamic) alias i32* @g.localdynamic
216 @a.initialexec = thread_local(initialexec) alias i32* @g.initialexec
217 ; CHECK: @a.initialexec = thread_local(initialexec) alias i32* @g.initialexec
218 @a.localexec = thread_local(localexec) alias i32* @g.localexec
219 ; CHECK: @a.localexec = thread_local(localexec) alias i32* @g.localexec
210 @a.notthreadlocal = alias i32, i32* @g.notthreadlocal
211 ; CHECK: @a.notthreadlocal = alias i32, i32* @g.notthreadlocal
212 @a.generaldynamic = thread_local alias i32, i32* @g.generaldynamic
213 ; CHECK: @a.generaldynamic = thread_local alias i32, i32* @g.generaldynamic
214 @a.localdynamic = thread_local(localdynamic) alias i32, i32* @g.localdynamic
215 ; CHECK: @a.localdynamic = thread_local(localdynamic) alias i32, i32* @g.localdynamic
216 @a.initialexec = thread_local(initialexec) alias i32, i32* @g.initialexec
217 ; CHECK: @a.initialexec = thread_local(initialexec) alias i32, i32* @g.initialexec
218 @a.localexec = thread_local(localexec) alias i32, i32* @g.localexec
219 ; CHECK: @a.localexec = thread_local(localexec) alias i32, i32* @g.localexec
220220
221221 ; Aliases -- unnamed_addr
222 @a.unnamed_addr = unnamed_addr alias i32* @g.unnamed_addr
223 ; CHECK: @a.unnamed_addr = unnamed_addr alias i32* @g.unnamed_addr
222 @a.unnamed_addr = unnamed_addr alias i32, i32* @g.unnamed_addr
223 ; CHECK: @a.unnamed_addr = unnamed_addr alias i32, i32* @g.unnamed_addr
224224
225225 ;; Functions
226226 ; Format: define [linkage] [visibility] [DLLStorageClass]
1818 ; Aliases Test
1919 ; CHECK: @glob1 = global i32 1
2020 @glob1 = global i32 1
21 ; CHECK: @aliased1 = alias i32* @glob1
22 @aliased1 = alias i32* @glob1
23 ; CHECK-NEXT: @aliased2 = internal alias i32* @glob1
24 @aliased2 = internal alias i32* @glob1
25 ; CHECK-NEXT: @aliased3 = alias i32* @glob1
26 @aliased3 = external alias i32* @glob1
27 ; CHECK-NEXT: @aliased4 = weak alias i32* @glob1
28 @aliased4 = weak alias i32* @glob1
29 ; CHECK-NEXT: @aliased5 = weak_odr alias i32* @glob1
30 @aliased5 = weak_odr alias i32* @glob1
21 ; CHECK: @aliased1 = alias i32, i32* @glob1
22 @aliased1 = alias i32, i32* @glob1
23 ; CHECK-NEXT: @aliased2 = internal alias i32, i32* @glob1
24 @aliased2 = internal alias i32, i32* @glob1
25 ; CHECK-NEXT: @aliased3 = alias i32, i32* @glob1
26 @aliased3 = external alias i32, i32* @glob1
27 ; CHECK-NEXT: @aliased4 = weak alias i32, i32* @glob1
28 @aliased4 = weak alias i32, i32* @glob1
29 ; CHECK-NEXT: @aliased5 = weak_odr alias i32, i32* @glob1
30 @aliased5 = weak_odr alias i32, i32* @glob1
3131
3232 ;Parameter Attribute Test
3333 ; CHECK: declare void @ParamAttr1(i8 zeroext)
2424
2525 @global = global i32 0
2626
27 @default.internal.alias = alias internal i32* @global
28 ; CHECK: @default.internal.alias = internal alias i32* @global
27 @default.internal.alias = alias internal i32, internal i32* @global
28 ; CHECK: @default.internal.alias = internal alias i32, i32* @global
2929
30 @hidden.internal.alias = hidden alias internal i32* @global
31 ; CHECK: @hidden.internal.alias = internal alias i32* @global
30 @hidden.internal.alias = hidden alias internal i32, internal i32* @global
31 ; CHECK: @hidden.internal.alias = internal alias i32, i32* @global
3232
33 @protected.internal.alias = protected alias internal i32* @global
34 ; CHECK: @protected.internal.alias = internal alias i32* @global
33 @protected.internal.alias = protected alias internal i32, internal i32* @global
34 ; CHECK: @protected.internal.alias = internal alias i32, i32* @global
3535
36 @default.private.alias = alias private i32* @global
37 ; CHECK: @default.private.alias = private alias i32* @global
36 @default.private.alias = alias private i32, private i32* @global
37 ; CHECK: @default.private.alias = private alias i32, i32* @global
3838
39 @hidden.private.alias = hidden alias private i32* @global
40 ; CHECK: @hidden.private.alias = private alias i32* @global
39 @hidden.private.alias = hidden alias private i32, private i32* @global
40 ; CHECK: @hidden.private.alias = private alias i32, i32* @global
4141
42 @protected.private.alias = protected alias private i32* @global
43 ; CHECK: @protected.private.alias = private alias i32* @global
42 @protected.private.alias = protected alias private i32, private i32* @global
43 ; CHECK: @protected.private.alias = private alias i32, i32* @global
4444
4545 define internal void @default.internal() {
4646 ; CHECK: define internal void @default.internal
99 @v2 = global [1 x i32] zeroinitializer
1010 ; CHECK: @v2 = global [1 x i32] zeroinitializer
1111
12 @v3 = alias bitcast (i32* @v1 to i16*)
13 ; CHECK: @v3 = alias bitcast (i32* @v1 to i16*)
12 @v3 = alias i16, bitcast (i32* @v1 to i16*)
13 ; CHECK: @v3 = alias i16, bitcast (i32* @v1 to i16*)
1414
15 @v4 = alias getelementptr ([1 x i32], [1 x i32]* @v2, i32 0, i32 0)
16 ; CHECK: @v4 = alias getelementptr inbounds ([1 x i32], [1 x i32]* @v2, i32 0, i32 0)
15 @v4 = alias i32, getelementptr ([1 x i32], [1 x i32]* @v2, i32 0, i32 0)
16 ; CHECK: @v4 = alias i32, getelementptr inbounds ([1 x i32], [1 x i32]* @v2, i32 0, i32 0)
1717
18 @v5 = alias i32 addrspace(2)* addrspacecast (i32 addrspace(0)* @v1 to i32 addrspace(2)*)
19 ; CHECK: @v5 = alias addrspacecast (i32* @v1 to i32 addrspace(2)*)
18 @v5 = alias i32, i32 addrspace(2)* addrspacecast (i32 addrspace(0)* @v1 to i32 addrspace(2)*)
19 ; CHECK: @v5 = alias i32, addrspacecast (i32* @v1 to i32 addrspace(2)*)
2020
21 @v6 = alias i16* @v3
22 ; CHECK: @v6 = alias i16* @v3
21 @v6 = alias i16, i16* @v3
22 ; CHECK: @v6 = alias i16, i16* @v3
0 ; RUN: verify-uselistorder < %s
11
22 @a = global [4 x i1] [i1 0, i1 1, i1 0, i1 1]
3 @b = alias i1* getelementptr ([4 x i1], [4 x i1]* @a, i64 0, i64 2)
3 @b = alias i1, getelementptr ([4 x i1], [4 x i1]* @a, i64 0, i64 2)
44
55 ; Check use-list order of constants used by globals.
66 @glob1 = global i5 7
99
1010 ; Check use-list order between variables and aliases.
1111 @target = global i3 zeroinitializer
12 @alias1 = alias i3* @target
13 @alias2 = alias i3* @target
14 @alias3 = alias i3* @target
12 @alias1 = alias i3, i3* @target
13 @alias2 = alias i3, i3* @target
14 @alias3 = alias i3, i3* @target
1515 @var1 = global i3* @target
1616 @var2 = global i3* @target
1717 @var3 = global i3* @target
3030
3131 ; Same as above, but for aliases.
3232 @const.target = global i62 1
33 @const.alias = alias i62* @const.target
34 @const.alias.ptr = alias i62* @const.alias
35 @const.alias.2 = alias i62* @const.target
33 @const.alias = alias i62, i62* @const.target
34 @const.alias.ptr = alias i62, i62* @const.alias
35 @const.alias.2 = alias i62, i62* @const.target
3636
3737 define i64 @f(i64 %f) {
3838 entry:
22 ; RUN: bugpoint -load %llvmshlibdir/BugpointPasses%shlibext %s -output-prefix %t -replace-funcs-with-null -bugpoint-crash-decl-funcs -silence-passes -safe-run-llc
33 ; REQUIRES: loadable_module
44
5 @foo2 = alias i32 ()* @foo
5 @foo2 = alias i32 (), i32 ()* @foo
66
77 define i32 @foo() { ret i32 1 }
88
22 @var32 = global [3 x i32] zeroinitializer
33 @var64 = global [3 x i64] zeroinitializer
44 @var32_align64 = global [3 x i32] zeroinitializer, align 8
5 @alias = alias [3 x i32]* @var32_align64
5 @alias = alias [3 x i32], [3 x i32]* @var32_align64
66
77 define i64 @test_align32() {
88 ; CHECK-LABEL: test_align32:
1919 @.str51 = external constant [45 x i8] ; <[45 x i8]*> [#uses=1]
2020 @__PRETTY_FUNCTION__._ZNK4llvm7VarInit12getFieldInitERNS_6RecordEPKNS_9RecordValERKSs = external constant [116 x i8] ; <[116 x i8]*> [#uses=1]
2121
22 @_ZN4llvm9RecordValC1ERKSsPNS_5RecTyEj = alias void (%"class.llvm::RecordVal"*, %"class.std::basic_string"*, %"struct.llvm::Init"*, i32)* @_ZN4llvm9RecordValC2ERKSsPNS_5RecTyEj ; [#uses=0]
22 @_ZN4llvm9RecordValC1ERKSsPNS_5RecTyEj = alias void (%"class.llvm::RecordVal"*, %"class.std::basic_string"*, %"struct.llvm::Init"*, i32), void (%"class.llvm::RecordVal"*, %"class.std::basic_string"*, %"struct.llvm::Init"*, i32)* @_ZN4llvm9RecordValC2ERKSsPNS_5RecTyEj ; [#uses=0]
2323
2424 declare i8* @__dynamic_cast(i8*, i8*, i8*, i32)
2525
3232 ; CHECK: .size elem1, 4
3333
3434 @bar = global i32 42
35 @foo1 = alias i32* @bar
36 @foo2 = alias i32* @bar
35 @foo1 = alias i32, i32* @bar
36 @foo2 = alias i32, i32* @bar
3737
3838 %FunTy = type i32()
3939
4040 define i32 @foo_f() {
4141 ret i32 0
4242 }
43 @bar_f = weak alias %FunTy* @foo_f
43 @bar_f = weak alias %FunTy, %FunTy* @foo_f
4444
45 @bar_i = internal alias i32* @bar
45 @bar_i = internal alias i32, i32* @bar
4646
47 @A = alias bitcast (i32* @bar to i64*)
47 @A = alias i64, bitcast (i32* @bar to i64*)
4848
4949 @structvar = private global {i32, i32} {i32 1, i32 2}
50 @elem0 = alias getelementptr({i32, i32}, {i32, i32}* @structvar, i32 0, i32 0)
51 @elem1 = alias getelementptr({i32, i32}, {i32, i32}* @structvar, i32 0, i32 1)
50 @elem0 = alias i32, getelementptr({i32, i32}, {i32, i32}* @structvar, i32 0, i32 0)
51 @elem1 = alias i32, getelementptr({i32, i32}, {i32, i32}* @structvar, i32 0, i32 1)
5252
5353 define i32 @test() {
5454 entry:
2929 %"struct.qdesigner_internal::GridLayout" = type { %"struct.qdesigner_internal::Layout", %"struct.QPair", %"struct.qdesigner_internal::Grid"* }
3030 %"struct.qdesigner_internal::Layout" = type { %struct.QObject, %"struct.QList", %struct.QWidget*, %"struct.QHash >", %struct.QWidget*, %struct.QDesignerFormWindowInterface*, i8, %"struct.QPair", %struct.QRect, i8 }
3131
32 @_ZL20__gthrw_pthread_oncePiPFvvE = weak alias i32 (i32*, void ()*)* @pthread_once ; [#uses=0]
33 @_ZL27__gthrw_pthread_getspecificj = weak alias i8* (i32)* @pthread_getspecific ; [#uses=0]
34 @_ZL27__gthrw_pthread_setspecificjPKv = weak alias i32 (i32, i8*)* @pthread_setspecific ; [#uses=0]
35 @_ZL22__gthrw_pthread_createPmPK14pthread_attr_tPFPvS3_ES3_ = weak alias i32 (i64*, %struct.pthread_attr_t*, i8* (i8*)*, i8*)* @pthread_create ; [#uses=0]
36 @_ZL22__gthrw_pthread_cancelm = weak alias i32 (i64)* @pthread_cancel ; [#uses=0]
37 @_ZL26__gthrw_pthread_mutex_lockP15pthread_mutex_t = weak alias i32 (%struct.pthread_mutex_t*)* @pthread_mutex_lock ; [#uses=0]
38 @_ZL29__gthrw_pthread_mutex_trylockP15pthread_mutex_t = weak alias i32 (%struct.pthread_mutex_t*)* @pthread_mutex_trylock ; [#uses=0]
39 @_ZL28__gthrw_pthread_mutex_unlockP15pthread_mutex_t = weak alias i32 (%struct.pthread_mutex_t*)* @pthread_mutex_unlock ; [#uses=0]
40 @_ZL26__gthrw_pthread_mutex_initP15pthread_mutex_tPK19pthread_mutexattr_t = weak alias i32 (%struct.pthread_mutex_t*, %struct.Alignment*)* @pthread_mutex_init ; [#uses=0]
41 @_ZL26__gthrw_pthread_key_createPjPFvPvE = weak alias i32 (i32*, void (i8*)*)* @pthread_key_create ; [#uses=0]
42 @_ZL26__gthrw_pthread_key_deletej = weak alias i32 (i32)* @pthread_key_delete ; [#uses=0]
43 @_ZL30__gthrw_pthread_mutexattr_initP19pthread_mutexattr_t = weak alias i32 (%struct.Alignment*)* @pthread_mutexattr_init ; [#uses=0]
44 @_ZL33__gthrw_pthread_mutexattr_settypeP19pthread_mutexattr_ti = weak alias i32 (%struct.Alignment*, i32)* @pthread_mutexattr_settype ; [#uses=0]
45 @_ZL33__gthrw_pthread_mutexattr_destroyP19pthread_mutexattr_t = weak alias i32 (%struct.Alignment*)* @pthread_mutexattr_destroy ; *)*> [#uses=0]
32 @_ZL20__gthrw_pthread_oncePiPFvvE = weak alias i32 (i32*, void ()*), i32 (i32*, void ()*)* @pthread_once ; *)*> [#uses=0]
33 @_ZL27__gthrw_pthread_getspecificj = weak alias i8* (i32), i8* (i32)* @pthread_getspecific ; [#uses=0]
34 @_ZL27__gthrw_pthread_setspecificjPKv = weak alias i32 (i32, i8*), i32 (i32, i8*)* @pthread_setspecific ; [#uses=0]
35 @_ZL22__gthrw_pthread_createPmPK14pthread_attr_tPFPvS3_ES3_ = weak alias i32 (i64*, %struct.pthread_attr_t*, i8* (i8*)*, i8*), i32 (i64*, %struct.pthread_attr_t*, i8* (i8*)*, i8*)* @pthread_create ; [#uses=0]
36 @_ZL22__gthrw_pthread_cancelm = weak alias i32 (i64), i32 (i64)* @pthread_cancel ; [#uses=0]
37 @_ZL26__gthrw_pthread_mutex_lockP15pthread_mutex_t = weak alias i32 (%struct.pthread_mutex_t*), i32 (%struct.pthread_mutex_t*)* @pthread_mutex_lock ; [#uses=0]
38 @_ZL29__gthrw_pthread_mutex_trylockP15pthread_mutex_t = weak alias i32 (%struct.pthread_mutex_t*), i32 (%struct.pthread_mutex_t*)* @pthread_mutex_trylock ; [#uses=0]
39 @_ZL28__gthrw_pthread_mutex_unlockP15pthread_mutex_t = weak alias i32 (%struct.pthread_mutex_t*), i32 (%struct.pthread_mutex_t*)* @pthread_mutex_unlock ; [#uses=0]
40 @_ZL26__gthrw_pthread_mutex_initP15pthread_mutex_tPK19pthread_mutexattr_t = weak alias i32 (%struct.pthread_mutex_t*, %struct.Alignment*), i32 (%struct.pthread_mutex_t*, %struct.Alignment*)* @pthread_mutex_init ; [#uses=0]
41 @_ZL26__gthrw_pthread_key_createPjPFvPvE = weak alias i32 (i32*, void (i8*)*), i32 (i32*, void (i8*)*)* @pthread_key_create ; [#uses=0]
42 @_ZL26__gthrw_pthread_key_deletej = weak alias i32 (i32), i32 (i32)* @pthread_key_delete ; [#uses=0]
43 @_ZL30__gthrw_pthread_mutexattr_initP19pthread_mutexattr_t = weak alias i32 (%struct.Alignment*), i32 (%struct.Alignment*)* @pthread_mutexattr_init ; [#uses=0]
44 @_ZL33__gthrw_pthread_mutexattr_settypeP19pthread_mutexattr_ti = weak alias i32 (%struct.Alignment*, i32), i32 (%struct.Alignment*, i32)* @pthread_mutexattr_settype ; [#uses=0]
45 @_ZL33__gthrw_pthread_mutexattr_destroyP19pthread_mutexattr_t = weak alias i32 (%struct.Alignment*), i32 (%struct.Alignment*)* @pthread_mutexattr_destroy ; [#uses=0]
4646
4747 define void @_ZN18qdesigner_internal10GridLayout9buildGridEv(%"struct.qdesigner_internal::GridLayout"* %this) nounwind {
4848 entry:
0 ; RUN: llc -march=mipsel -relocation-model=pic -disable-mips-delay-filler < %s | FileCheck %s
11
22 @foo = thread_local global i32 42
3 @bar = hidden thread_local alias i32* @foo
3 @bar = hidden thread_local alias i32, i32* @foo
44
55 define i32* @zed() {
66 ; CHECK-DAG: __tls_get_addr
11 ; RUN: llc < %s -mtriple=powerpc64-unknown-linux-gnu -code-model=large | FileCheck --check-prefix=CHECK --check-prefix=LARGE %s
22
33 @foo = global i32 42
4 @fooa = alias i32* @foo
4 @fooa = alias i32, i32* @foo
55
66 @foo2 = global i64 42
7 @foo2a = alias i64* @foo2
7 @foo2a = alias i64, i64* @foo2
88
99 ; CHECK-LABEL: bar:
1010 define i32 @bar() {
0 ; RUN: llc < %s -mtriple=i686-pc-linux-gnu | FileCheck %s
11
2 @__gthrw_pthread_once = weak alias i32 (i32*, void ()*)* @pthread_once ; [#uses=0]
2 @__gthrw_pthread_once = weak alias i32 (i32*, void ()*), i32 (i32*, void ()*)* @pthread_once ; [#uses=0]
33
44 define weak i32 @pthread_once(i32*, void ()*) {
55 ret i32 0
77 @__resp = thread_local global %struct.__res_state* @_res ; <%struct.__res_state**> [#uses=1]
88 @_res = global %struct.__res_state zeroinitializer, section ".bss" ; <%struct.__res_state*> [#uses=1]
99
10 @__libc_resp = hidden thread_local alias %struct.__res_state** @__resp ; <%struct.__res_state**> [#uses=2]
10 @__libc_resp = hidden thread_local alias %struct.__res_state*, %struct.__res_state** @__resp ; <%struct.__res_state**> [#uses=2]
1111
1212 define i32 @foo() {
1313 ; CHECK-LABEL: foo:
55 %struct.locale_data = type { i8*, i8*, i32, i32, { void (%struct.locale_data*)*, %struct.anon }, i32, i32, i32, [0 x %struct.locale_data_value] }
66 %struct.locale_data_value = type { i32* }
77
8 @wcstoll_l = alias i64 (i32*, i32**, i32, %struct.__locale_struct*)* @__wcstoll_l
8 @wcstoll_l = alias i64 (i32*, i32**, i32, %struct.__locale_struct*), i64 (i32*, i32**, i32, %struct.__locale_struct*)* @__wcstoll_l
99
1010 define i64 @____wcstoll_l_internal(i32* %nptr, i32** %endptr, i32 %base, i32 %group, %struct.__locale_struct* %loc) nounwind {
1111 entry:
11 ; RUN: -relocation-model=pic | FileCheck %s
22
33 @thread_var = thread_local global i32 42, align 4
4 @thread_alias = thread_local(localdynamic) alias i32* @thread_var
4 @thread_alias = thread_local(localdynamic) alias i32, i32* @thread_var
55
66 ; CHECK-LABEL: get_thread_var
77 define i32* @get_thread_var() {
1818 @bar = global i32 42
1919
2020 ; CHECK-DAG: .globl foo1
21 @foo1 = alias i32* @bar
21 @foo1 = alias i32, i32* @bar
2222
2323 ; CHECK-DAG: .globl foo2
24 @foo2 = alias i32* @bar
24 @foo2 = alias i32, i32* @bar
2525
2626 %FunTy = type i32()
2727
2929 ret i32 0
3030 }
3131 ; CHECK-DAG: .weak bar_f
32 @bar_f = weak alias %FunTy* @foo_f
32 @bar_f = weak alias %FunTy, %FunTy* @foo_f
3333
34 @bar_l = linkonce_odr alias i32* @bar
34 @bar_l = linkonce_odr alias i32, i32* @bar
3535 ; CHECK-DAG: .weak bar_l
3636
37 @bar_i = internal alias i32* @bar
37 @bar_i = internal alias i32, i32* @bar
3838
3939 ; CHECK-DAG: .globl A
40 @A = alias bitcast (i32* @bar to i64*)
40 @A = alias i64, bitcast (i32* @bar to i64*)
4141
4242 ; CHECK-DAG: .globl bar_h
4343 ; CHECK-DAG: .hidden bar_h
44 @bar_h = hidden alias i32* @bar
44 @bar_h = hidden alias i32, i32* @bar
4545
4646 ; CHECK-DAG: .globl bar_p
4747 ; CHECK-DAG: .protected bar_p
48 @bar_p = protected alias i32* @bar
48 @bar_p = protected alias i32, i32* @bar
4949
5050 ; CHECK-DAG: test2 = bar+4
51 @test2 = alias getelementptr(i32, i32* @bar, i32 1)
51 @test2 = alias i32, getelementptr(i32, i32* @bar, i32 1)
5252
5353 ; CHECK-DAG: test3 = 42
54 @test3 = alias inttoptr(i32 42 to i32*)
54 @test3 = alias i32, inttoptr(i32 42 to i32*)
5555
5656 ; CHECK-DAG: test4 = bar
57 @test4 = alias inttoptr(i64 ptrtoint (i32* @bar to i64) to i32*)
57 @test4 = alias i32, inttoptr(i64 ptrtoint (i32* @bar to i64) to i32*)
5858
5959 ; CHECK-DAG: test5 = test2-bar
60 @test5 = alias inttoptr(i32 sub (i32 ptrtoint (i32* @test2 to i32),
60 @test5 = alias i32, inttoptr(i32 sub (i32 ptrtoint (i32* @test2 to i32),
6161 i32 ptrtoint (i32* @bar to i32)) to i32*)
6262
6363 ; CHECK-DAG: .globl test
5252 $vftable = comdat largest
5353
5454 @some_name = private unnamed_addr constant [2 x i8*] zeroinitializer, comdat($vftable)
55 @vftable = alias getelementptr([2 x i8*], [2 x i8*]* @some_name, i32 0, i32 1)
55 @vftable = alias i8*, getelementptr([2 x i8*], [2 x i8*]* @some_name, i32 0, i32 1)
5656
5757 ; CHECK: .section .text,"xr",discard,_f1
5858 ; CHECK: .globl _f1
5252
5353 ; CHECK: .globl alias
5454 ; CHECK: alias = notExported
55 @alias = dllexport alias void()* @notExported
55 @alias = dllexport alias void(), void()* @notExported
5656
5757 ; CHECK: .globl alias2
5858 ; CHECK: alias2 = f1
59 @alias2 = dllexport alias void()* @f1
59 @alias2 = dllexport alias void(), void()* @f1
6060
6161 ; CHECK: .globl alias3
6262 ; CHECK: alias3 = notExported
63 @alias3 = dllexport alias void()* @notExported
63 @alias3 = dllexport alias void(), void()* @notExported
6464
6565 ; CHECK: .weak weak_alias
6666 ; CHECK: weak_alias = f1
67 @weak_alias = weak_odr dllexport alias void()* @f1
67 @weak_alias = weak_odr dllexport alias void(), void()* @f1
6868
6969 @blob = global [6 x i8] c"\B8*\00\00\00\C3", section ".text", align 16
70 @blob_alias = dllexport alias bitcast ([6 x i8]* @blob to i32 ()*)
70 @blob_alias = dllexport alias i32 (), bitcast ([6 x i8]* @blob to i32 ()*)
7171
7272 ; CHECK: .section .drectve
7373 ; WIN32: /EXPORT:f1
7373
7474 ; CHECK: .globl _alias
7575 ; CHECK: _alias = _notExported
76 @alias = dllexport alias void()* @notExported
76 @alias = dllexport alias void(), void()* @notExported
7777
7878 ; CHECK: .globl _alias2
7979 ; CHECK: _alias2 = _f1
80 @alias2 = dllexport alias void()* @f1
80 @alias2 = dllexport alias void(), void()* @f1
8181
8282 ; CHECK: .globl _alias3
8383 ; CHECK: _alias3 = _notExported
84 @alias3 = dllexport alias void()* @notExported
84 @alias3 = dllexport alias void(), void()* @notExported
8585
8686 ; CHECK: .weak _weak_alias
8787 ; CHECK: _weak_alias = _f1
88 @weak_alias = weak_odr dllexport alias void()* @f1
88 @weak_alias = weak_odr dllexport alias void(), void()* @f1
8989
9090 ; CHECK: .section .drectve
9191 ; CHECK-CL-NOT: not_exported
1414 ; CHECK-NEXT: calll __emutls_get_address@PLT
1515 ; CHECK-NEXT: movl (%eax), %eax
1616
17 @alias = internal alias i32* @v
17 @alias = internal alias i32, i32* @v
1818 define i32 @f_alias() nounwind {
1919 entry:
2020 %t = load i32, i32* @v
1212 ; CHECK: leal v@TLSGD
1313 ; CHECK: __tls_get_addr
1414
15 @alias = internal alias i32* @v
15 @alias = internal alias i32, i32* @v
1616 define i32 @f_alias() nounwind {
1717 entry:
1818 %t = load i32, i32* @v
1919 @var = global i32 0
2020
2121 ; CHECK: alias = var
22 @alias = alias i32* @var
22 @alias = alias i32, i32* @var
0 ; RUN: llc < %s -mtriple=x86_64-pc-linux -relocation-model=pic -o %t1
11 ; RUN: grep "callq g@PLT" %t1
22
3 @g = weak alias i32 ()* @f
3 @g = weak alias i32 (), i32 ()* @f
44
55 define void @h() {
66 entry:
44 @b_val = constant i32 42, section ".cp.rodata"
55 @c_val = global i32 42
66
7 @a = alias void ()* @a_val
8 @b = alias i32* @b_val
9 @c = alias i32* @c_val
7 @a = alias void (), void ()* @a_val
8 @b = alias i32, i32* @b_val
9 @c = alias i32, i32* @c_val
1010
1111 ; CHECK-LABEL: a_addr:
1212 ; CHECK: ldap r11, a
1616
1717 %class.D = type { i32, i32, i32, i32 }
1818
19 @_ZN1DC1Ev = alias void (%class.D*)* @_ZN1DC2Ev
20 @_ZN1DC1ERKS_ = alias void (%class.D*, %class.D*)* @_ZN1DC2ERKS_
19 @_ZN1DC1Ev = alias void (%class.D*), void (%class.D*)* @_ZN1DC2Ev
20 @_ZN1DC1ERKS_ = alias void (%class.D*, %class.D*), void (%class.D*, %class.D*)* @_ZN1DC2ERKS_
2121
2222 define void @_ZN1DC2Ev(%class.D* nocapture %this) unnamed_addr nounwind uwtable align 2 {
2323 entry:
88 %class.anon = type { i8 }
99 %class.anon.0 = type { i8 }
1010
11 @"_ZN8functionIFvvEEC1IZN17BPLFunctionWriter9writeExprEvE3$_1_0EET_" = internal alias void (%class.function*)* @"_ZN8functionIFvvEEC2IZN17BPLFunctionWriter9writeExprEvE3$_1_0EET_"
12 @"_ZN8functionIFvvEEC1IZN17BPLFunctionWriter9writeExprEvE3$_0EET_" = internal alias void (%class.function*)* @"_ZN8functionIFvvEEC2IZN17BPLFunctionWriter9writeExprEvE3$_0EET_"
11 @"_ZN8functionIFvvEEC1IZN17BPLFunctionWriter9writeExprEvE3$_1_0EET_" = internal alias void (%class.function*), void (%class.function*)* @"_ZN8functionIFvvEEC2IZN17BPLFunctionWriter9writeExprEvE3$_1_0EET_"
12 @"_ZN8functionIFvvEEC1IZN17BPLFunctionWriter9writeExprEvE3$_0EET_" = internal alias void (%class.function*), void (%class.function*)* @"_ZN8functionIFvvEEC2IZN17BPLFunctionWriter9writeExprEvE3$_0EET_"
1313
1414 define void @_ZN17BPLFunctionWriter9writeExprEv(%class.BPLFunctionWriter* %this) nounwind uwtable align 2 {
1515 entry:
1313 @_ZTS1A = linkonce_odr constant [3 x i8] c"1A\00"
1414 @_ZTI1A = linkonce_odr constant { i8*, i8* } { i8* bitcast (i8** getelementptr inbounds (i8*, i8** @_ZTVN10__cxxabiv117__class_type_infoE, i64 2) to i8*), i8* getelementptr inbounds ([3 x i8], [3 x i8]* @_ZTS1A, i32 0, i32 0) }
1515
16 @_ZN1AC1Ei = alias void (%class.A*, i32)* @_ZN1AC2Ei
17 @_ZN1AC1ERKS_ = alias void (%class.A*, %class.A*)* @_ZN1AC2ERKS_
16 @_ZN1AC1Ei = alias void (%class.A*, i32), void (%class.A*, i32)* @_ZN1AC2Ei
17 @_ZN1AC1ERKS_ = alias void (%class.A*, %class.A*), void (%class.A*, %class.A*)* @_ZN1AC2ERKS_
1818
1919 ; Function Attrs: nounwind uwtable
2020 define void @_ZN1AC2Ei(%class.A* %this, i32 %i) unnamed_addr #0 align 2 {
88 @v3 = global [2 x i16] zeroinitializer
99 ; CHECK: @v3 = global [2 x i16] zeroinitializer
1010
11 @a1 = alias bitcast (i32* @v1 to i16*)
12 ; CHECK: @a1 = alias bitcast (i32* @v1 to i16*)
11 @a1 = alias i16, bitcast (i32* @v1 to i16*)
12 ; CHECK: @a1 = alias i16, bitcast (i32* @v1 to i16*)
1313
14 @a2 = alias bitcast([1 x i32]* @v2 to i32*)
15 ; CHECK: @a2 = alias getelementptr inbounds ([1 x i32], [1 x i32]* @v2, i32 0, i32 0)
14 @a2 = alias i32, bitcast([1 x i32]* @v2 to i32*)
15 ; CHECK: @a2 = alias i32, getelementptr inbounds ([1 x i32], [1 x i32]* @v2, i32 0, i32 0)
1616
17 @a3 = alias addrspacecast (i32* @v1 to i32 addrspace(2)*)
18 ; CHECK: @a3 = alias addrspacecast (i32* @v1 to i32 addrspace(2)*)
17 @a3 = alias i32, addrspacecast (i32* @v1 to i32 addrspace(2)*)
18 ; CHECK: @a3 = alias i32, addrspacecast (i32* @v1 to i32 addrspace(2)*)
1919
20 @a4 = alias bitcast (i32* @v1 to i16*)
21 ; CHECK: @a4 = alias bitcast (i32* @v1 to i16*)
20 @a4 = alias i16, bitcast (i32* @v1 to i16*)
21 ; CHECK: @a4 = alias i16, bitcast (i32* @v1 to i16*)
2222
23 @a5 = thread_local(localdynamic) alias i32* @v1
24 ; CHECK: @a5 = thread_local(localdynamic) alias i32* @v1
23 @a5 = thread_local(localdynamic) alias i32, i32* @v1
24 ; CHECK: @a5 = thread_local(localdynamic) alias i32, i32* @v1
2525
26 @a6 = alias getelementptr ([2 x i16], [2 x i16]* @v3, i32 1, i32 1)
27 ; CHECK: @a6 = alias getelementptr ([2 x i16], [2 x i16]* @v3, i32 1, i32 1)
26 @a6 = alias i16, getelementptr ([2 x i16], [2 x i16]* @v3, i32 1, i32 1)
27 ; CHECK: @a6 = alias i16, getelementptr ([2 x i16], [2 x i16]* @v3, i32 1, i32 1)
44 @llvm.used = appending global [1 x i8*] [i8* bitcast (i32* @foo1 to i8*)], section "llvm.metadata"
55
66 @bar = global i32 0
7 @foo1 = alias i32* @bar
8 @foo2 = alias i32* @bar
9 @foo3 = alias i32* @foo2
10 @foo4 = unnamed_addr alias i32* @foo2
7 @foo1 = alias i32, i32* @bar
8 @foo2 = alias i32, i32* @bar
9 @foo3 = alias i32, i32* @foo2
10 @foo4 = unnamed_addr alias i32, i32* @foo2
1111
1212 ; Make sure the verifier does not complain about references to a global
1313 ; declaration from an initializer.
1414 @decl = external global i32
1515 @ptr = global i32* @decl
16 @ptr_a = alias i32** @ptr
16 @ptr_a = alias i32*, i32** @ptr
1717
1818 %FunTy = type i32()
1919
2020 define i32 @foo_f() {
2121 ret i32 0
2222 }
23 @bar_f = weak_odr alias %FunTy* @foo_f
24 @bar_ff = alias i32()* @bar_f
23 @bar_f = weak_odr alias %FunTy, %FunTy* @foo_f
24 @bar_ff = alias i32(), i32()* @bar_f
2525
26 @bar_i = internal alias i32* @bar
26 @bar_i = internal alias i32, i32* @bar
2727
28 @A = alias bitcast (i32* @bar to i64*)
28 @A = alias i64, bitcast (i32* @bar to i64*)
2929
3030 define i32 @test() {
3131 entry:
88 @v = global i32 0, comdat($f)
99 ; CHECK: @v = global i32 0, comdat($f)
1010
11 @a = alias i32* @v
12 ; CHECK: @a = alias i32* @v{{$}}
11 @a = alias i32, i32* @v
12 ; CHECK: @a = alias i32, i32* @v{{$}}
1313
1414 define void @f() comdat($f) {
1515 ret void
55 ; no action should be taken for these globals
66 $global_noinst = comdat largest
77 @aliasee = private unnamed_addr constant [2 x i8] [i8 1, i8 2], comdat($global_noinst)
8 @global_noinst = unnamed_addr alias [2 x i8]* @aliasee
8 @global_noinst = unnamed_addr alias [2 x i8], [2 x i8]* @aliasee
99 ; CHECK-NOT: {{asan_gen.*global_noinst}}
10 ; CHECK-DAG: @global_noinst = unnamed_addr alias [2 x i8]* @aliasee
10 ; CHECK-DAG: @global_noinst = unnamed_addr alias [2 x i8], [2 x i8]* @aliasee
1111 @global_inst = private constant [2 x i8] [i8 1, i8 2]
1212 ; CHECK-DAG: {{asan_gen.*global_inst}}
1313 ; CHECK: @asan.module_ctor
1616 ; CHECK: %[[CALL:.*]] = call { i32 (i32, i32)*, i16 } @"dfs$g"(i32 %0, i16 0)
1717 ; CHECK: %[[XVAL:.*]] = extractvalue { i32 (i32, i32)*, i16 } %[[CALL]], 0
1818 ; CHECK: ret {{.*}} %[[XVAL]]
19 @discardg = alias i32 (i32, i32)* (i32)* @g
19 @discardg = alias i32 (i32, i32)* (i32), i32 (i32, i32)* (i32)* @g
2020
2121 declare void @custom1(i32 %a, i32 %b)
2222
8282 ; CHECK: %[[IVAL0:.*]] = insertvalue { i32, i16 } undef, i32 %[[CALL]], 0
8383 ; CHECK: %[[IVAL1:.*]] = insertvalue { i32, i16 } %[[IVAL0]], i16 0, 1
8484 ; CHECK: ret { i32, i16 } %[[IVAL1]]
85 @adiscard = alias i32 (i32, i32)* @discard
85 @adiscard = alias i32 (i32, i32), i32 (i32, i32)* @discard
8686
8787 ; CHECK: declare void @__dfsw_custom1(i32, i32, i16, i16)
8888 ; CHECK: declare i32 @__dfsw_custom2(i32, i32, i16, i16, i16*)
66 module asm ".symver f1,f@@version1"
77
88 ; CHECK: @"dfs$f2" = alias {{.*}} @"dfs$f1"
9 @f2 = alias void ()* @f1
9 @f2 = alias void (), void ()* @f1
1010
1111 ; CHECK: @"dfs$g2" = alias {{.*}} @"dfs$g1"
12 @g2 = alias bitcast (void (i8*)* @g1 to void (i16*)*)
12 @g2 = alias void (i16*), bitcast (void (i8*)* @g1 to void (i16*)*)
1313
1414 ; CHECK: define void @"dfs$f1"
1515 define void @f1() {
77 target triple = "x86_64-unknown-linux-gnu"
88 @foo = weak global i32 0 ; [#uses=1]
99
10 @bar = weak alias i32* @foo ; [#uses=1]
10 @bar = weak alias i32, i32* @foo ; [#uses=1]
1111
1212 define i32 @baz() nounwind {
1313 entry:
22 ; RUN: llvm-as %p/2008-07-06-AliasFnDecl2.ll -o %t2.bc
33 ; RUN: llvm-link %t1.bc %t2.bc -o %t3.bc
44
5 @b = alias void ()* @a
5 @b = alias void (), void ()* @a
66
77 define void @a() nounwind {
88 entry:
66 target datalayout = "e-p:32:32:32-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:32:64-f32:32:32-f64:32:64-v64:64:64-v128:128:128-a0:0:64-f80:32:32"
77 target triple = "i386-pc-linux-gnu"
88
9 @sched_clock = alias i64 ()* @native_sched_clock
9 @sched_clock = alias i64 (), i64 ()* @native_sched_clock
1010
11 @foo = alias i32* @realfoo
11 @foo = alias i32, i32* @realfoo
1212 @realfoo = global i32 0
1313
1414 define i64 @native_sched_clock() nounwind {
0 %foo = type { [8 x i8] }
11 %bar = type { [9 x i8] }
22
3 @zed = alias bitcast (void (%bar*)* @xyz to void (%foo*)*)
3 @zed = alias void (%foo*), bitcast (void (%bar*)* @xyz to void (%foo*)*)
44
55 define void @xyz(%bar* %this) {
66 entry:
0 @zed = global i32 42
1 @foo = alias i32* @zed
2 @foo2 = alias bitcast (i32* @zed to i16*)
1 @foo = alias i32, i32* @zed
2 @foo2 = alias i16, bitcast (i32* @zed to i16*)
33
44 @zed = external constant i8
55 @some_name = private unnamed_addr constant [2 x i8*] [i8* @zed, i8* bitcast (void ()* @bar to i8*)], comdat($foo)
6 @foo = alias getelementptr([2 x i8*], [2 x i8*]* @some_name, i32 0, i32 1)
6 @foo = alias i8*, getelementptr([2 x i8*], [2 x i8*]* @some_name, i32 0, i32 1)
77
88 declare void @bar() unnamed_addr
0 $c1 = comdat largest
11
22 @some_name = private unnamed_addr constant i32 42, comdat($c1)
3 @c1 = alias i32* @some_name
3 @c1 = alias i32, i32* @some_name
0 %u = type { i8 }
11
22 @g2 = global %u zeroinitializer
3 @a = weak alias %u* @g2
3 @a = weak alias %u, %u* @g2
66 @v4 = hidden global i32 1, comdat($c1)
77
88 ; Aliases
9 @a1 = weak hidden alias i32* @v1
10 @a2 = weak protected alias i32* @v2
11 @a3 = weak hidden alias i32* @v3
9 @a1 = weak hidden alias i32, i32* @v1
10 @a2 = weak protected alias i32, i32* @v2
11 @a3 = weak hidden alias i32, i32* @v3
1212
1313 ; Functions
1414 define weak hidden void @f1() {
11 ; RUN: llvm-link %S/Inputs/alias.ll %s -S -o - | FileCheck %s
22
33 @foo = weak global i32 0
4 ; CHECK-DAG: @foo = alias i32* @zed
4 ; CHECK-DAG: @foo = alias i32, i32* @zed
55
6 @bar = alias i32* @foo
7 ; CHECK-DAG: @bar = alias i32* @foo
6 @bar = alias i32, i32* @foo
7 ; CHECK-DAG: @bar = alias i32, i32* @foo
88
99 @foo2 = weak global i32 0
10 ; CHECK-DAG: @foo2 = alias bitcast (i32* @zed to i16*)
10 ; CHECK-DAG: @foo2 = alias i16, bitcast (i32* @zed to i16*)
1111
12 @bar2 = alias i32* @foo2
13 ; CHECK-DAG: @bar2 = alias bitcast (i16* @foo2 to i32*)
12 @bar2 = alias i32, i32* @foo2
13 ; CHECK-DAG: @bar2 = alias i32, bitcast (i16* @foo2 to i32*)
1414
1515 ; CHECK-DAG: @zed = global i32 42
44 $foo = comdat largest
55 @foo = linkonce_odr unnamed_addr constant [1 x i8*] [i8* bitcast (void ()* @bar to i8*)], comdat($foo)
66
7 ; CHECK: @foo = alias getelementptr inbounds ([2 x i8*], [2 x i8*]* @some_name, i32 0, i32 1)
7 ; CHECK: @foo = alias i8*, getelementptr inbounds ([2 x i8*], [2 x i8*]* @some_name, i32 0, i32 1)
88
99 declare void @bar() unnamed_addr
22 $c1 = comdat largest
33
44 @some_name = private unnamed_addr constant i32 42, comdat($c1)
5 @c1 = alias i8* inttoptr (i32 ptrtoint (i32* @some_name to i32) to i8*)
5 @c1 = alias i8, inttoptr (i32 ptrtoint (i32* @some_name to i32) to i8*)
66
77 ; CHECK: COMDAT key involves incomputable alias size.
0 ; RUN: llvm-link %s -S -o - | FileCheck %s
11
22 $c = comdat any
3 @a = alias void ()* @f
3 @a = alias void (), void ()* @f
44 define internal void @f() comdat($c) {
55 ret void
66 }
77
88 ; CHECK-DAG: $c = comdat any
9 ; CHECK-DAG: @a = alias void ()* @f
9 ; CHECK-DAG: @a = alias void (), void ()* @f
1010 ; CHECK-DAG: define internal void @f() comdat($c)
1111
1212 $f2 = comdat largest
33 $_ZN3fooIiEC5Ev = comdat any
44 ; CHECK: $_ZN3fooIiEC5Ev = comdat any
55
6 @_ZN3fooIiEC1Ev = weak_odr alias void ()* @_ZN3fooIiEC2Ev
7 ; CHECK: @_ZN3fooIiEC1Ev = weak_odr alias void ()* @_ZN3fooIiEC2Ev
6 @_ZN3fooIiEC1Ev = weak_odr alias void (), void ()* @_ZN3fooIiEC2Ev
7 ; CHECK: @_ZN3fooIiEC1Ev = weak_odr alias void (), void ()* @_ZN3fooIiEC2Ev
88
99 ; CHECK: define weak_odr void @_ZN3fooIiEC2Ev() comdat($_ZN3fooIiEC5Ev) {
1010 define weak_odr void @_ZN3fooIiEC2Ev() comdat($_ZN3fooIiEC5Ev) {
55 @g2 = linkonce_odr global i8 0
66 ; CHECK-NOT: @g2
77
8 @a1 = private alias i8* @g1
8 @a1 = private alias i8, i8* @g1
99 ; CHECK-NOT: @a1
1010
11 @a2 = linkonce_odr alias i8* @g2
11 @a2 = linkonce_odr alias i8, i8* @g2
1212 ; CHECK-NOT: @a2
1313
1414 define private void @f1() {
22 %t = type { i8 }
33
44 @g = global %t zeroinitializer
5 @a = weak alias %t* @g
5 @a = weak alias %t, %t* @g
66
77 ; CHECK: @g = global %t zeroinitializer
88 ; CHECK: @g2 = global %t zeroinitializer
9 ; CHECK: @a = weak alias %t* @g
9 ; CHECK: @a = weak alias %t, %t* @g
2121 ; CHECK-DAG: @global-f = global i32 42
2222
2323 @alias-a = weak global i32 42
24 ; CHECK-DAG: @alias-a = alias i32* @global-f
24 ; CHECK-DAG: @alias-a = alias i32, i32* @global-f
2525 @alias-b = weak unnamed_addr global i32 42
26 ; CHECK-DAG: @alias-b = unnamed_addr alias i32* @global-f
26 ; CHECK-DAG: @alias-b = unnamed_addr alias i32, i32* @global-f
2727
2828 declare void @func-c()
2929 ; CHECK-DAG: define weak void @func-c() {
4343 ; CHECK-DAG: @global-j = global i32 42
4444
4545 @alias-c = weak global i32 42
46 ; CHECK-DAG: @alias-c = alias i32* @global-f
46 ; CHECK-DAG: @alias-c = alias i32, i32* @global-f
4747 @alias-d = weak unnamed_addr global i32 42
48 ; CHECK-DAG: @alias-d = alias i32* @global-f
48 ; CHECK-DAG: @alias-d = alias i32, i32* @global-f
4949
5050
5151 declare void @func-g()
55 @global-e = unnamed_addr global i32 42
66 @global-f = unnamed_addr global i32 42
77
8 @alias-a = unnamed_addr alias i32* @global-f
9 @alias-b = unnamed_addr alias i32* @global-f
8 @alias-a = unnamed_addr alias i32, i32* @global-f
9 @alias-b = unnamed_addr alias i32, i32* @global-f
1010
1111 define weak void @func-c() unnamed_addr { ret void }
1212 define weak void @func-d() unnamed_addr { ret void }
1717 @global-i = global i32 42
1818 @global-j = global i32 42
1919
20 @alias-c = alias i32* @global-f
21 @alias-d = alias i32* @global-f
20 @alias-c = alias i32, i32* @global-f
21 @alias-d = alias i32, i32* @global-f
2222
2323 define weak void @func-g() { ret void }
2424 define weak void @func-h() { ret void }
2020 @v4 = global i32 1, comdat($c1)
2121
2222 ; Aliases
23 ; CHECK: @a1 = hidden alias i32* @v1
24 @a1 = alias i32* @v1
23 ; CHECK: @a1 = hidden alias i32, i32* @v1
24 @a1 = alias i32, i32* @v1
2525
26 ; CHECK: @a2 = protected alias i32* @v2
27 @a2 = alias i32* @v2
26 ; CHECK: @a2 = protected alias i32, i32* @v2
27 @a2 = alias i32, i32* @v2
2828
29 ; CHECK: @a3 = hidden alias i32* @v3
30 @a3 = protected alias i32* @v3
29 ; CHECK: @a3 = hidden alias i32, i32* @v3
30 @a3 = protected alias i32, i32* @v3
3131
3232
3333 ; Functions
2626 @g3 = common global i32 0
2727 @g4 = private global i32 42
2828
29 @a1 = alias i32* @g1
30 @a2 = internal alias i32* @g1
29 @a1 = alias i32, i32* @g1
30 @a2 = internal alias i32, i32* @g1
3131
3232 define void @f1() {
3333 ret void
1111 ; CHECK: declare void @a0bar()
1212
1313 ; DELETE: @zed = global i32 0
14 ; DELETE: @zeda0 = alias i32* @zed
15 ; DELETE-NEXT: @a0foo = alias i32* ()* @foo
16 ; DELETE-NEXT: @a0a0bar = alias void ()* @bar
17 ; DELETE-NEXT: @a0bar = alias void ()* @bar
14 ; DELETE: @zeda0 = alias i32, i32* @zed
15 ; DELETE-NEXT: @a0foo = alias i32* (), i32* ()* @foo
16 ; DELETE-NEXT: @a0a0bar = alias void (), void ()* @bar
17 ; DELETE-NEXT: @a0bar = alias void (), void ()* @bar
1818 ; DELETE: declare i32* @foo()
1919 ; DELETE: define void @bar() {
2020 ; DELETE-NEXT: %c = call i32* @foo()
2222 ; DELETE-NEXT: }
2323
2424 ; ALIAS: @zed = external global i32
25 ; ALIAS: @zeda0 = alias i32* @zed
25 ; ALIAS: @zeda0 = alias i32, i32* @zed
2626
27 ; ALIASRE: @a0a0bar = alias void ()* @bar
28 ; ALIASRE: @a0bar = alias void ()* @bar
27 ; ALIASRE: @a0a0bar = alias void (), void ()* @bar
28 ; ALIASRE: @a0bar = alias void (), void ()* @bar
2929 ; ALIASRE: declare void @bar()
3030
3131 @zed = global i32 0
32 @zeda0 = alias i32* @zed
32 @zeda0 = alias i32, i32* @zed
3333
34 @a0foo = alias i32* ()* @foo
34 @a0foo = alias i32* (), i32* ()* @foo
3535
3636 define i32* @foo() {
3737 call void @a0bar()
3838 ret i32* @zeda0
3939 }
4040
41 @a0a0bar = alias void ()* @bar
41 @a0a0bar = alias void (), void ()* @bar
4242
43 @a0bar = alias void ()* @bar
43 @a0bar = alias void (), void ()* @bar
4444
4545 define void @bar() {
4646 %c = call i32* @foo()
1111 ; WITH: T bar
1212 ; WITH: T foo
1313
14 @a0foo = alias void ()* @foo
14 @a0foo = alias void (), void ()* @foo
1515
1616 define void @foo() {
1717 ret void
1818 }
1919
20 @a0bar = alias void ()* @bar
20 @a0bar = alias void (), void ()* @bar
2121
2222 define void @bar() {
2323 ret void
1919 }
2020
2121 %struct.S = type { i8 }
22 @_ZN1SC1Ev = alias void (%struct.S*)* @_ZN1SC2Ev
22 @_ZN1SC1Ev = alias void (%struct.S*), void (%struct.S*)* @_ZN1SC2Ev
2323 define void @_ZN1SC2Ev(%struct.S* %this) unnamed_addr align 2 {
2424 entry:
2525 %this.addr = alloca %struct.S*, align 4
2424 ; CHECK-NEXT: @var7 = internal constant [16 x i8] c"foo1bar2foo3bar\00"
2525 ; CHECK-NEXT: @var8 = private constant [16 x i8] c"foo1bar2foo3bar\00", align 16
2626
27 @var4a = alias %struct.foobar* @var4
27 @var4a = alias %struct.foobar, %struct.foobar* @var4
2828 @llvm.used = appending global [1 x %struct.foobar*] [%struct.foobar* @var4a], section "llvm.metadata"
2929
3030 define i32 @main() {
1616 %"struct.std::pair > > >,bool>" = type { %"struct.std::_Rb_tree_iterator > > >", i8 }
1717 %"struct.std::pair" = type { i8*, i8* }
1818
19 @_ZL20__gthrw_pthread_oncePiPFvvE = weak alias i32 (i32*, void ()*)* @pthread_once ; [#uses=0]
20 @_ZL27__gthrw_pthread_getspecificj = weak alias i8* (i32)* @pthread_getspecific ; [#uses=0]
21 @_ZL27__gthrw_pthread_setspecificjPKv = weak alias i32 (i32, i8*)* @pthread_setspecific ; [#uses=0]
22 @_ZL22__gthrw_pthread_createPmPK16__pthread_attr_sPFPvS3_ES3_ = weak alias i32 (i32*, %struct.pthread_attr_t*, i8* (i8*)*, i8*)* @pthread_create ; [#uses=0]
23 @_ZL22__gthrw_pthread_cancelm = weak alias i32 (i32)* @pthread_cancel ; [#uses=0]
24 @_ZL26__gthrw_pthread_mutex_lockP15pthread_mutex_t = weak alias i32 (%struct.pthread_mutex_t*)* @pthread_mutex_lock ; [#uses=0]
25 @_ZL29__gthrw_pthread_mutex_trylockP15pthread_mutex_t = weak alias i32 (%struct.pthread_mutex_t*)* @pthread_mutex_trylock ; [#uses=0]
26 @_ZL28__gthrw_pthread_mutex_unlockP15pthread_mutex_t = weak alias i32 (%struct.pthread_mutex_t*)* @pthread_mutex_unlock ; [#uses=0]
27 @_ZL26__gthrw_pthread_mutex_initP15pthread_mutex_tPK19pthread_mutexattr_t = weak alias i32 (%struct.pthread_mutex_t*, %struct.__sched_param*)* @pthread_mutex_init ; [#uses=0]
28 @_ZL26__gthrw_pthread_key_createPjPFvPvE = weak alias i32 (i32*, void (i8*)*)* @pthread_key_create ; [#uses=0]
29 @_ZL26__gthrw_pthread_key_deletej = weak alias i32 (i32)* @pthread_key_delete ; [#uses=0]
30 @_ZL30__gthrw_pthread_mutexattr_initP19pthread_mutexattr_t = weak alias i32 (%struct.__sched_param*)* @pthread_mutexattr_init ; [#uses=0]
31 @_ZL33__gthrw_pthread_mutexattr_settypeP19pthread_mutexattr_ti = weak alias i32 (%struct.__sched_param*, i32)* @pthread_mutexattr_settype ; [#uses=0]
32 @_ZL33__gthrw_pthread_mutexattr_destroyP19pthread_mutexattr_t = weak alias i32 (%struct.__sched_param*)* @pthread_mutexattr_destroy ; *)*> [#uses=0]
19 @_ZL20__gthrw_pthread_oncePiPFvvE = weak alias i32 (i32*, void ()*), i32 (i32*, void ()*)* @pthread_once ; *)*> [#uses=0]
20 @_ZL27__gthrw_pthread_getspecificj = weak alias i8* (i32), i8* (i32)* @pthread_getspecific ; [#uses=0]
21 @_ZL27__gthrw_pthread_setspecificjPKv = weak alias i32 (i32, i8*), i32 (i32, i8*)* @pthread_setspecific ; [#uses=0]
22 @_ZL22__gthrw_pthread_createPmPK16__pthread_attr_sPFPvS3_ES3_ = weak alias i32 (i32*, %struct.pthread_attr_t*, i8* (i8*)*, i8*), i32 (i32*, %struct.pthread_attr_t*, i8* (i8*)*, i8*)* @pthread_create ; [#uses=0]
23 @_ZL22__gthrw_pthread_cancelm = weak alias i32 (i32), i32 (i32)* @pthread_cancel ; [#uses=0]
24 @_ZL26__gthrw_pthread_mutex_lockP15pthread_mutex_t = weak alias i32 (%struct.pthread_mutex_t*), i32 (%struct.pthread_mutex_t*)* @pthread_mutex_lock ; [#uses=0]
25 @_ZL29__gthrw_pthread_mutex_trylockP15pthread_mutex_t = weak alias i32 (%struct.pthread_mutex_t*), i32 (%struct.pthread_mutex_t*)* @pthread_mutex_trylock ; [#uses=0]
26 @_ZL28__gthrw_pthread_mutex_unlockP15pthread_mutex_t = weak alias i32 (%struct.pthread_mutex_t*), i32 (%struct.pthread_mutex_t*)* @pthread_mutex_unlock ; [#uses=0]
27 @_ZL26__gthrw_pthread_mutex_initP15pthread_mutex_tPK19pthread_mutexattr_t = weak alias i32 (%struct.pthread_mutex_t*, %struct.__sched_param*), i32 (%struct.pthread_mutex_t*, %struct.__sched_param*)* @pthread_mutex_init ; [#uses=0]
28 @_ZL26__gthrw_pthread_key_createPjPFvPvE = weak alias i32 (i32*, void (i8*)*), i32 (i32*, void (i8*)*)* @pthread_key_create ; [#uses=0]
29 @_ZL26__gthrw_pthread_key_deletej = weak alias i32 (i32), i32 (i32)* @pthread_key_delete ; [#uses=0]
30 @_ZL30__gthrw_pthread_mutexattr_initP19pthread_mutexattr_t = weak alias i32 (%struct.__sched_param*), i32 (%struct.__sched_param*)* @pthread_mutexattr_init ; [#uses=0]
31 @_ZL33__gthrw_pthread_mutexattr_settypeP19pthread_mutexattr_ti = weak alias i32 (%struct.__sched_param*, i32), i32 (%struct.__sched_param*, i32)* @pthread_mutexattr_settype ; [#uses=0]
32 @_ZL33__gthrw_pthread_mutexattr_destroyP19pthread_mutexattr_t = weak alias i32 (%struct.__sched_param*), i32 (%struct.__sched_param*)* @pthread_mutexattr_destroy ; [#uses=0]
3333
3434 declare fastcc void @_ZNSt10_Select1stISt4pairIKPvS1_EEC1Ev() nounwind readnone
3535
44 @A = global i32 0
55 ; CHECK: @A = global i32 0
66
7 @D = internal alias i32* @A
7 @D = internal alias i32, i32* @A
88 ; DEAD-NOT: @D
99
10 @L1 = alias i32* @A
11 ; CHECK: @L1 = alias i32* @A
10 @L1 = alias i32, i32* @A
11 ; CHECK: @L1 = alias i32, i32* @A
1212
13 @L2 = internal alias i32* @L1
14 ; CHECK: @L2 = internal alias i32* @L1
13 @L2 = internal alias i32, i32* @L1
14 ; CHECK: @L2 = internal alias i32, i32* @L1
1515
16 @L3 = alias i32* @L2
17 ; CHECK: @L3 = alias i32* @L2
16 @L3 = alias i32, i32* @L2
17 ; CHECK: @L3 = alias i32, i32* @L2
0 ; RUN: opt < %s -globaldce
11
2 @A = internal alias void ()* @F
2 @A = internal alias void (), void ()* @F
33 define internal void @F() { ret void }
22 $c1 = comdat any
33 ; CHECK: $c1 = comdat any
44
5 @a1 = linkonce_odr alias void ()* @f1
6 ; CHECK: @a1 = linkonce_odr alias void ()* @f1
5 @a1 = linkonce_odr alias void (), void ()* @f1
6 ; CHECK: @a1 = linkonce_odr alias void (), void ()* @f1
77
88 define linkonce_odr void @f1() comdat($c1) {
99 ret void
11
22 @g = global i32 0
33
4 @a = alias bitcast (i32* @g to i8*)
4 @a = alias i8, bitcast (i32* @g to i8*)
55
66 define void @f() {
77 %tmp = load i8, i8* @a
55 ret void
66 }
77
8 @a = alias void ()* @f
8 @a = alias void (), void ()* @f
99
1010 define void @g() {
1111 call void() @a()
1212 ret void
1313 }
1414
15 @b = internal alias void ()* @g
15 @b = internal alias void (), void ()* @g
1616 ; CHECK-NOT: @b
1717
1818 define void @h() {
0 ; RUN: opt < %s -globalopt -S | FileCheck %s
11
2 @foo1 = alias void ()* @foo2
3 ; CHECK: @foo1 = alias void ()* @bar2
2 @foo1 = alias void (), void ()* @foo2
3 ; CHECK: @foo1 = alias void (), void ()* @bar2
44
5 @foo2 = alias void()* @bar1
6 ; CHECK: @foo2 = alias void ()* @bar2
5 @foo2 = alias void(), void()* @bar1
6 ; CHECK: @foo2 = alias void (), void ()* @bar2
77
8 @bar1 = alias void ()* @bar2
9 ; CHECK: @bar1 = alias void ()* @bar2
8 @bar1 = alias void (), void ()* @bar2
9 ; CHECK: @bar1 = alias void (), void ()* @bar2
1010
11 @weak1 = weak alias void ()* @bar2
12 ; CHECK: @weak1 = weak alias void ()* @bar2
11 @weak1 = weak alias void (), void ()* @bar2
12 ; CHECK: @weak1 = weak alias void (), void ()* @bar2
1313
1414 @bar4 = private unnamed_addr constant [2 x i8*] zeroinitializer
15 @foo4 = linkonce_odr unnamed_addr alias getelementptr inbounds ([2 x i8*], [2 x i8*]* @bar4, i32 0, i32 1)
16 ; CHECK: @foo4 = linkonce_odr unnamed_addr alias getelementptr inbounds ([2 x i8*], [2 x i8*]* @bar4, i32 0, i32 1)
15 @foo4 = linkonce_odr unnamed_addr alias i8*, getelementptr inbounds ([2 x i8*], [2 x i8*]* @bar4, i32 0, i32 1)
16 ; CHECK: @foo4 = linkonce_odr unnamed_addr alias i8*, getelementptr inbounds ([2 x i8*], [2 x i8*]* @bar4, i32 0, i32 1)
1717
1818 define void @bar2() {
1919 ret void
3636 ret void
3737 }
3838
39 @foo3 = alias void ()* @bar3
39 @foo3 = alias void (), void ()* @bar3
4040 ; CHECK-NOT: bar3
4141
4242 define internal void @bar3() {
66 @i = internal addrspace(1) global i8 42
77
88 ; CHECK: @ia = internal addrspace(1) global i8 42
9 @ia = internal alias i8 addrspace(1)* @i
9 @ia = internal alias i8, i8 addrspace(1)* @i
1010
1111 @llvm.used = appending global [1 x i8*] [i8* addrspacecast (i8 addrspace(1)* @ca to i8*)], section "llvm.metadata"
1212 ; CHECK-DAG: @llvm.used = appending global [1 x i8*] [i8* addrspacecast (i8 addrspace(1)* @ca to i8*)], section "llvm.metadata"
1717 @sameAsUsed = global [1 x i8*] [i8* addrspacecast(i8 addrspace(1)* @ca to i8*)]
1818 ; CHECK-DAG: @sameAsUsed = global [1 x i8*] [i8* addrspacecast (i8 addrspace(1)* @c to i8*)]
1919
20 @ca = internal alias i8 addrspace(1)* @c
21 ; CHECK: @ca = internal alias i8 addrspace(1)* @c
20 @ca = internal alias i8, i8 addrspace(1)* @c
21 ; CHECK: @ca = internal alias i8, i8 addrspace(1)* @c
2222
2323 define i8 addrspace(1)* @h() {
2424 ret i8 addrspace(1)* @ca
0 ; RUN: opt -S -globalopt < %s | FileCheck %s
11
22 @_Z17in_custom_section = internal global i8 42, section "CUSTOM"
3 @in_custom_section = internal dllexport alias i8* @_Z17in_custom_section
3 @in_custom_section = internal dllexport alias i8, i8* @_Z17in_custom_section
44
55 ; CHECK: @in_custom_section = internal dllexport global i8 42, section "CUSTOM"
66
33
44 @i = internal global i8 42
55 ; CHECK: @ia = internal global i8 42
6 @ia = internal alias i8* @i
6 @ia = internal alias i8, i8* @i
77
88 @llvm.used = appending global [3 x i8*] [i8* bitcast (void ()* @fa to i8*), i8* bitcast (void ()* @f to i8*), i8* @ca], section "llvm.metadata"
99 ; CHECK-DAG: @llvm.used = appending global [3 x i8*] [i8* bitcast (void ()* @fa to i8*), i8* bitcast (void ()* @f to i8*), i8* @ca], section "llvm.metadata"
1717 @other = global i32* bitcast (void ()* @fa to i32*)
1818 ; CHECK-DAG: @other = global i32* bitcast (void ()* @f to i32*)
1919
20 @fa = internal alias void ()* @f
21 ; CHECK: @fa = internal alias void ()* @f
20 @fa = internal alias void (), void ()* @f
21 ; CHECK: @fa = internal alias void (), void ()* @f
2222
23 @fa2 = internal alias void ()* @f
23 @fa2 = internal alias void (), void ()* @f
2424 ; CHECK-NOT: @fa2
2525
26 @fa3 = internal alias void ()* @f
26 @fa3 = internal alias void (), void ()* @f
2727 ; CHECK: @fa3
2828
29 @ca = internal alias i8* @c
30 ; CHECK: @ca = internal alias i8* @c
29 @ca = internal alias i8, i8* @c
30 ; CHECK: @ca = internal alias i8, i8* @c
3131
3232 define void @f() {
3333 ret void
0 ; RUN: opt < %s -instcombine -S | grep icmp
11 ; PR1646
22
3 @__gthrw_pthread_cancel = weak alias i32 (i32)* @pthread_cancel ; [#uses=1]
3 @__gthrw_pthread_cancel = weak alias i32 (i32), i32 (i32)* @pthread_cancel ; [#uses=1]
44 @__gthread_active_ptr.5335 = internal constant i8* bitcast (i32 (i32)* @__gthrw_pthread_cancel to i8*) ; [#uses=1]
55 define weak i32 @pthread_cancel(i32) {
66 ret i32 0
0 ; RUN: opt < %s -instcombine -S | grep icmp
11 ; PR1678
22
3 @A = weak alias void ()* @B ; [#uses=1]
3 @A = weak alias void (), void ()* @B ; [#uses=1]
44
55 define weak void @B() {
66 ret void
66
77 @0 = constant [1 x i8*] zeroinitializer
88
9 @vtbl = alias getelementptr inbounds ([1 x i8*], [1 x i8*]* @0, i32 0, i32 0)
9 @vtbl = alias i8*, getelementptr inbounds ([1 x i8*], [1 x i8*]* @0, i32 0, i32 0)
1010
1111 define i32 (%class.A*)* @test() {
1212 ; CHECK-LABEL: test
55 ; Cases that should be bitcast
66
77 ; Test cast between scalars with same bit sizes
8 @alias_i32_to_f32 = alias bitcast (i32 (i32)* @func_i32 to float (float)*)
8 @alias_i32_to_f32 = alias float (float), bitcast (i32 (i32)* @func_i32 to float (float)*)
99
1010 ; Test cast between vectors with same number of elements and bit sizes
11 @alias_v2i32_to_v2f32 = alias bitcast (<2 x i32> (<2 x i32>)* @func_v2i32 to <2 x float> (<2 x float>)*)
11 @alias_v2i32_to_v2f32 = alias <2 x float> (<2 x float>), bitcast (<2 x i32> (<2 x i32>)* @func_v2i32 to <2 x float> (<2 x float>)*)
1212
1313 ; Test cast from vector to scalar with same number of bits
14 @alias_v2f32_to_i64 = alias bitcast (i64 (i64)* @func_i64 to <2 x float> (<2 x float>)*)
14 @alias_v2f32_to_i64 = alias <2 x float> (<2 x float>), bitcast (i64 (i64)* @func_i64 to <2 x float> (<2 x float>)*)
1515
1616 ; Test cast from scalar to vector with same number of bits
17 @alias_i64_to_v2f32 = alias bitcast (<2 x float> (<2 x float>)* @func_v2f32 to i64 (i64)*)
17 @alias_i64_to_v2f32 = alias i64 (i64), bitcast (<2 x float> (<2 x float>)* @func_v2f32 to i64 (i64)*)
1818
1919 ; Test cast between vectors of pointers
20 @alias_v2i32p_to_v2i64p = alias bitcast (<2 x i32*> (<2 x i32*>)* @func_v2i32p to <2 x i64*> (<2 x i64*>)*)
20 @alias_v2i32p_to_v2i64p = alias <2 x i64*> (<2 x i64*>), bitcast (<2 x i32*> (<2 x i32*>)* @func_v2i32p to <2 x i64*> (<2 x i64*>)*)
2121
2222
2323 ; Cases that should be invalid and unchanged
2424
2525 ; Test cast between scalars with different bit sizes
26 @alias_i64_to_f32 = alias bitcast (i64 (i64)* @func_i64 to float (float)*)
26 @alias_i64_to_f32 = alias float (float), bitcast (i64 (i64)* @func_i64 to float (float)*)
2727
2828 ; Test cast between vectors with different bit sizes but the
2929 ; same number of elements
30 @alias_v2i64_to_v2f32 = alias bitcast (<2 x i64> (<2 x i64>)* @func_v2i64 to <2 x float> (<2 x float>)*)
30 @alias_v2i64_to_v2f32 = alias <2 x float> (<2 x float>), bitcast (<2 x i64> (<2 x i64>)* @func_v2i64 to <2 x float> (<2 x float>)*)
3131
3232 ; Test cast between vectors with same number of bits and different
3333 ; numbers of elements
34 @alias_v2i32_to_v4f32 = alias bitcast (<2 x i32> (<2 x i32>)* @func_v2i32 to <4 x float> (<4 x float>)*)
34 @alias_v2i32_to_v4f32 = alias <4 x float> (<4 x float>), bitcast (<2 x i32> (<2 x i32>)* @func_v2i32 to <4 x float> (<4 x float>)*)
3535
3636 ; Test cast between scalar and vector with different number of bits
37 @alias_i64_to_v4f32 = alias bitcast (<4 x float> (<4 x float>)* @func_v4f32 to i64 (i64)*)
37 @alias_i64_to_v4f32 = alias i64 (i64), bitcast (<4 x float> (<4 x float>)* @func_v4f32 to i64 (i64)*)
3838
3939 ; Test cast between vector and scalar with different number of bits
40 @alias_v4f32_to_i64 = alias bitcast (i64 (i64)* @func_i64 to <4 x float> (<4 x float>)*)
40 @alias_v4f32_to_i64 = alias <4 x float> (<4 x float>), bitcast (i64 (i64)* @func_i64 to <4 x float> (<4 x float>)*)
4141
4242 ; Test cast from scalar to vector of pointers with same number of bits
4343 ; We don't know the pointer size at this point, so this can't be done
44 @alias_i64_to_v2i32p = alias bitcast (<2 x i32*> (<2 x i32*>)* @func_v2i32p to i64 (i64)*)
44 @alias_i64_to_v2i32p = alias i64 (i64), bitcast (<2 x i32*> (<2 x i32*>)* @func_v2i32p to i64 (i64)*)
4545
4646 ; Test cast between vector of pointers and scalar with different number of bits
47 @alias_v4i32p_to_i64 = alias bitcast (i64 (i64)* @func_i64 to <4 x i32*> (<4 x i32*>)*)
47 @alias_v4i32p_to_i64 = alias <4 x i32*> (<4 x i32*>), bitcast (i64 (i64)* @func_i64 to <4 x i32*> (<4 x i32*>)*)
4848
4949
5050
55 @G2 = global i32 42
66 @G3 = global [4 x i8] zeroinitializer, align 1
77
8 @A1 = alias bitcast (i8* getelementptr inbounds ([4 x i8], [4 x i8]* @G3, i32 0, i32 2) to i32*)
9 @A2 = alias inttoptr (i64 and (i64 ptrtoint (i8* getelementptr inbounds ([4 x i8], [4 x i8]* @G3, i32 0, i32 3) to i64), i64 -4) to i32*)
8 @A1 = alias i32, bitcast (i8* getelementptr inbounds ([4 x i8], [4 x i8]* @G3, i32 0, i32 2) to i32*)
9 @A2 = alias i32, inttoptr (i64 and (i64 ptrtoint (i8* getelementptr inbounds ([4 x i8], [4 x i8]* @G3, i32 0, i32 3) to i64), i64 -4) to i32*)
1010
1111 define i64 @f1() {
1212 ; This cannot be constant folded because G1 is underaligned.
3131 ret i16 %1
3232 }
3333
34 @a_alias = weak alias [60 x i8] addrspace(3)* @a_as3
34 @a_alias = weak alias [60 x i8], [60 x i8] addrspace(3)* @a_as3
3535 define i32 @foo_alias() nounwind {
3636 %1 = call i32 @llvm.objectsize.i32.p3i8(i8 addrspace(3)* getelementptr inbounds ([60 x i8], [60 x i8] addrspace(3)* @a_alias, i32 0, i32 0), i1 false)
3737 ret i32 %1
218218 ret i32 %1
219219 }
220220
221 @globalalias = internal alias [60 x i8]* @a
221 @globalalias = internal alias [60 x i8], [60 x i8]* @a
222222
223223 ; CHECK-LABEL: @test18(
224224 ; CHECK-NEXT: ret i32 60
228228 ret i32 %1
229229 }
230230
231 @globalalias2 = weak alias [60 x i8]* @a
231 @globalalias2 = weak alias [60 x i8], [60 x i8]* @a
232232
233233 ; CHECK-LABEL: @test19(
234234 ; CHECK: llvm.objectsize
22 @A = global i32 0
33 ; CHECK: @A = internal global i32 0
44
5 @B = alias i32* @A
6 ; CHECK: @B = internal alias i32* @A
5 @B = alias i32, i32* @A
6 ; CHECK: @B = internal alias i32, i32* @A
77
8 @C = alias i32* @A
9 ; CHECK: @C = internal alias i32* @A
8 @C = alias i32, i32* @A
9 ; CHECK: @C = internal alias i32, i32* @A
1010
1111 define i32 @main() {
1212 %tmp = load i32, i32* @C
1616 ; CHECK: @c4_a = internal global i32 0, comdat($c4)
1717 @c4_a = internal global i32 0, comdat($c4)
1818
19 ; CHECK: @c1_d = alias i32* @c1_c
20 @c1_d = alias i32* @c1_c
19 ; CHECK: @c1_d = alias i32, i32* @c1_c
20 @c1_d = alias i32, i32* @c1_c
2121
22 ; CHECK: @c2_c = internal alias i32* @c2_b
23 @c2_c = alias i32* @c2_b
22 ; CHECK: @c2_c = internal alias i32, i32* @c2_b
23 @c2_c = alias i32, i32* @c2_b
2424
25 ; CHECK: @c4 = alias i32* @c4_a
26 @c4 = alias i32* @c4_a
25 ; CHECK: @c4 = alias i32, i32* @c4_a
26 @c4 = alias i32, i32* @c4_a
2727
2828 ; CHECK: define void @c1() comdat {
2929 define void @c1() comdat {
99 ; CHECK: @protected.variable = internal global i32 0
1010 @protected.variable = protected global i32 0
1111
12 ; CHECK: @hidden.alias = internal alias i32* @global
13 @hidden.alias = hidden alias i32* @global
14 ; CHECK: @protected.alias = internal alias i32* @global
15 @protected.alias = protected alias i32* @global
12 ; CHECK: @hidden.alias = internal alias i32, i32* @global
13 @hidden.alias = hidden alias i32, i32* @global
14 ; CHECK: @protected.alias = internal alias i32, i32* @global
15 @protected.alias = protected alias i32, i32* @global
1616
1717 ; CHECK: define internal void @hidden.function() {
1818 define hidden void @hidden.function() {
77
88 ; CHECK: @[[JT:.*]] = private constant [2 x <{ i8, i32, i8, i8, i8 }>] [<{ i8, i32, i8, i8, i8 }> <{ i8 -23, i32 trunc (i64 sub (i64 sub (i64 ptrtoint (void ()* @[[FNAME:.*]] to i64), i64 ptrtoint ([2 x <{ i8, i32, i8, i8, i8 }>]* @[[JT]] to i64)), i64 5) to i32), i8 -52, i8 -52, i8 -52 }>, <{ i8, i32, i8, i8, i8 }> <{ i8 -23, i32 trunc (i64 sub (i64 sub (i64 ptrtoint (void ()* @[[GNAME:.*]] to i64), i64 ptrtoint ([2 x <{ i8, i32, i8, i8, i8 }>]* @[[JT]] to i64)), i64 13) to i32), i8 -52, i8 -52, i8 -52 }>], section ".text"
99
10 ; CHECK: @f = alias bitcast ([2 x <{ i8, i32, i8, i8, i8 }>]* @[[JT]] to void ()*)
11 ; CHECK: @g = alias bitcast (<{ i8, i32, i8, i8, i8 }>* getelementptr inbounds ([2 x <{ i8, i32, i8, i8, i8 }>], [2 x <{ i8, i32, i8, i8, i8 }>]* @[[JT]], i64 0, i64 1) to void ()*)
10 ; CHECK: @f = alias void (), bitcast ([2 x <{ i8, i32, i8, i8, i8 }>]* @[[JT]] to void ()*)
11 ; CHECK: @g = alias void (), bitcast (<{ i8, i32, i8, i8, i8 }>* getelementptr inbounds ([2 x <{ i8, i32, i8, i8, i8 }>], [2 x <{ i8, i32, i8, i8, i8 }>]* @[[JT]], i64 0, i64 1) to void ()*)
1212
1313 ; CHECK: define private void @[[FNAME]]() {
1414 define void @f() {
3737
3838 !llvm.bitsets = !{ !0, !1, !2, !3, !4, !5, !6, !7 }
3939
40 ; CHECK: @bits_use{{[0-9]*}} = private alias i8* @bits{{[0-9]*}}
41 ; CHECK: @bits_use.{{[0-9]*}} = private alias i8* @bits{{[0-9]*}}
42 ; CHECK: @bits_use.{{[0-9]*}} = private alias i8* @bits{{[0-9]*}}
40 ; CHECK: @bits_use{{[0-9]*}} = private alias i8, i8* @bits{{[0-9]*}}
41 ; CHECK: @bits_use.{{[0-9]*}} = private alias i8, i8* @bits{{[0-9]*}}
42 ; CHECK: @bits_use.{{[0-9]*}} = private alias i8, i8* @bits{{[0-9]*}}
4343
44 ; CHECK: @a = alias getelementptr inbounds ({ i32, [0 x i8], [63 x i32], [4 x i8], i32, [0 x i8], [2 x i32] }, { i32, [0 x i8], [63 x i32], [4 x i8], i32, [0 x i8], [2 x i32] }* [[G]], i32 0, i32 0)
45 ; CHECK: @b = hidden alias getelementptr inbounds ({ i32, [0 x i8], [63 x i32], [4 x i8], i32, [0 x i8], [2 x i32] }, { i32, [0 x i8], [63 x i32], [4 x i8], i32, [0 x i8], [2 x i32] }* [[G]], i32 0, i32 2)
46 ; CHECK: @c = protected alias getelementptr inbounds ({ i32, [0 x i8], [63 x i32], [4 x i8], i32, [0 x i8], [2 x i32] }, { i32, [0 x i8], [63 x i32], [4 x i8], i32, [0 x i8], [2 x i32] }* [[G]], i32 0, i32 4)
47 ; CHECK: @d = alias getelementptr inbounds ({ i32, [0 x i8], [63 x i32], [4 x i8], i32, [0 x i8], [2 x i32] }, { i32, [0 x i8], [63 x i32], [4 x i8], i32, [0 x i8], [2 x i32] }* [[G]], i32 0, i32 6)
44 ; CHECK: @a = alias i32, getelementptr inbounds ({ i32, [0 x i8], [63 x i32], [4 x i8], i32, [0 x i8], [2 x i32] }, { i32, [0 x i8], [63 x i32], [4 x i8], i32, [0 x i8], [2 x i32] }* [[G]], i32 0, i32 0)
45 ; CHECK: @b = hidden alias [63 x i32], getelementptr inbounds ({ i32, [0 x i8], [63 x i32], [4 x i8], i32, [0 x i8], [2 x i32] }, { i32, [0 x i8], [63 x i32], [4 x i8], i32, [0 x i8], [2 x i32] }* [[G]], i32 0, i32 2)
46 ; CHECK: @c = protected alias i32, getelementptr inbounds ({ i32, [0 x i8], [63 x i32], [4 x i8], i32, [0 x i8], [2 x i32] }, { i32, [0 x i8], [63 x i32], [4 x i8], i32, [0 x i8], [2 x i32] }* [[G]], i32 0, i32 4)
47 ; CHECK: @d = alias [2 x i32], getelementptr inbounds ({ i32, [0 x i8], [63 x i32], [4 x i8], i32, [0 x i8], [2 x i32] }, { i32, [0 x i8], [63 x i32], [4 x i8], i32, [0 x i8], [2 x i32] }* [[G]], i32 0, i32 6)
4848
4949 ; CHECK-DARWIN: @aptr = constant i32* getelementptr inbounds ({ i32, [0 x i8], [63 x i32], [4 x i8], i32, [0 x i8], [2 x i32] }, { i32, [0 x i8], [63 x i32], [4 x i8], i32, [0 x i8], [2 x i32] }* [[G:@[^ ]*]], i32 0, i32 0)
5050 @aptr = constant i32* @a
6060
6161 ; CHECK-DARWIN: [[G]] = private constant
6262
63 ; CHECK: @bits{{[0-9]*}} = private alias getelementptr inbounds ([68 x i8], [68 x i8]* [[BA]], i32 0, i32 0)
64 ; CHECK: @bits.{{[0-9]*}} = private alias getelementptr inbounds ([68 x i8], [68 x i8]* [[BA]], i32 0, i32 0)
63 ; CHECK: @bits{{[0-9]*}} = private alias i8, getelementptr inbounds ([68 x i8], [68 x i8]* [[BA]], i32 0, i32 0)
64 ; CHECK: @bits.{{[0-9]*}} = private alias i8, getelementptr inbounds ([68 x i8], [68 x i8]* [[BA]], i32 0, i32 0)
6565
6666 declare i1 @llvm.bitset.test(i8* %ptr, metadata %bitset) nounwind readnone
6767
1111 @func_5_xxx.static_local_3_xxx = internal global i32 3, align 4
1212 @global_3_xxx = common global i32 0, align 4
1313
14 @func_7_xxx = weak alias i32 (...)* @aliased_func_7_xxx
14 @func_7_xxx = weak alias i32 (...), i32 (...)* @aliased_func_7_xxx
1515
1616 define i32 @aliased_func_7_xxx(...) {
1717 ret i32 0
0 ; RUN: opt < %s -sccp -S | FileCheck %s
11
22 @0 = private unnamed_addr constant [2 x i32] [i32 -1, i32 1]
3 @"\01??_7A@@6B@" = unnamed_addr alias getelementptr inbounds ([2 x i32], [2 x i32]* @0, i32 0, i32 1)
3 @"\01??_7A@@6B@" = unnamed_addr alias i32, getelementptr inbounds ([2 x i32], [2 x i32]* @0, i32 0, i32 1)
44
55 ; CHECK: ret i32 1
66
11
22
33 declare void @f()
4 @fa = alias void ()* @f
4 @fa = alias void (), void ()* @f
55 ; CHECK: Alias must point to a definition
66 ; CHECK-NEXT: @fa
77
88 @g = external global i32
9 @ga = alias i32* @g
9 @ga = alias i32, i32* @g
1010 ; CHECK: Alias must point to a definition
1111 ; CHECK-NEXT: @ga
1212
1313
14 @test2_a = alias i32* @test2_b
15 @test2_b = alias i32* @test2_a
14 @test2_a = alias i32, i32* @test2_b
15 @test2_b = alias i32, i32* @test2_a
1616 ; CHECK: Aliases cannot form a cycle
1717 ; CHECK-NEXT: i32* @test2_a
1818 ; CHECK-NEXT: Aliases cannot form a cycle
2020
2121
2222 @test3_a = global i32 42
23 @test3_b = weak alias i32* @test3_a
24 @test3_c = alias i32* @test3_b
23 @test3_b = weak alias i32, i32* @test3_a
24 @test3_c = alias i32, i32* @test3_b
2525 ; CHECK: Alias cannot point to a weak alias
2626 ; CHECK-NEXT: i32* @test3_c
66
77 @data = addrspace(2) global i32 27
88
9 @illegal_alias_data = alias bitcast (i32 addrspace(2)* @data to i32 addrspace(1)*)
9 @illegal_alias_data = alias i32, bitcast (i32 addrspace(2)* @data to i32 addrspace(1)*)
1616 @r21 = global i32* @v1
1717 @r22 = global i32(i8*)* @f1
1818
19 @a21 = alias i32* @v1
20 @a22 = alias bitcast (i32* @v1 to i16*)
19 @a21 = alias i32, i32* @v1
20 @a22 = alias i16, bitcast (i32* @v1 to i16*)
2121
22 @a23 = alias i32(i8*)* @f1
23 @a24 = alias bitcast (i32(i8*)* @f1 to i16*)
24 @a25 = alias i16* @a24
22 @a23 = alias i32(i8*), i32(i8*)* @f1
23 @a24 = alias i16, bitcast (i32(i8*)* @f1 to i16*)
24 @a25 = alias i16, i16* @a24
88 ; CHECK-NEXT: @b = global i32 1
99 ; CHECK-NOT: alias
1010
11 @a = weak alias i32* @b
11 @a = weak alias i32, i32* @b
1212 @b = global i32 1
88 @g1 = global i32 1
99 @g2 = global i32 2
1010
11 @a = alias inttoptr(i32 sub (i32 ptrtoint (i32* @g1 to i32),
11 @a = alias inttoptr(i32 sub (i32 ptrtoint (i32, inttoptr(i32 sub (i32 ptrtoint (i32* @g1 to i32),
1212 i32 ptrtoint (i32* @g2 to i32)) to i32*)
1616 @r11 = global i32* @v1
1717 @r12 = global i32 (i8*)* @f1
1818
19 @a11 = alias i32* @v1
20 @a12 = alias bitcast (i32* @v1 to i16*)
19 @a11 = alias i32, i32* @v1
20 @a12 = alias i16, bitcast (i32* @v1 to i16*)
2121
22 @a13 = alias i32 (i8*)* @f1
23 @a14 = alias bitcast (i32 (i8*)* @f1 to i16*)
24 @a15 = alias i16* @a14
22 @a13 = alias i32 (i8*), i32 (i8*)* @f1
23 @a14 = alias i16, bitcast (i32 (i8*)* @f1 to i16*)
24 @a15 = alias i16, i16* @a14
2525
2626 ; CHECK: $c1 = comdat any
2727 ; CHECK: $c2 = comdat any
3636
3737 ; CHECK: @v11 = internal global i32 41, comdat($c2)
3838
39 ; CHECK: @a11 = alias i32* @v1{{$}}
40 ; CHECK: @a12 = alias bitcast (i32* @v1 to i16*)
39 ; CHECK: @a11 = alias i32, i32* @v1{{$}}
40 ; CHECK: @a12 = alias i16, bitcast (i32* @v1 to i16*)
4141
42 ; CHECK: @a13 = alias i32 (i8*)* @f1{{$}}
43 ; CHECK: @a14 = alias bitcast (i32 (i8*)* @f1 to i16*)
42 ; CHECK: @a13 = alias i32 (i8*), i32 (i8*)* @f1{{$}}
43 ; CHECK: @a14 = alias i16, bitcast (i32 (i8*)* @f1 to i16*)
4444
45 ; CHECK: @a21 = alias i32* @v11{{$}}
46 ; CHECK: @a22 = alias bitcast (i32* @v11 to i16*)
45 ; CHECK: @a21 = alias i32, i32* @v11{{$}}
46 ; CHECK: @a22 = alias i16, bitcast (i32* @v11 to i16*)
4747
48 ; CHECK: @a23 = alias i32 (i8*)* @f12{{$}}
49 ; CHECK: @a24 = alias bitcast (i32 (i8*)* @f12 to i16*)
48 ; CHECK: @a23 = alias i32 (i8*), i32 (i8*)* @f12{{$}}
49 ; CHECK: @a24 = alias i16, bitcast (i32 (i8*)* @f12 to i16*)
5050
5151 ; CHECK: define weak_odr protected i32 @f1(i8*) comdat($c1) {
5252 ; CHECK-NEXT: bb10:
11 ; RUN: llvm-dis -o - %t0 | FileCheck --check-prefix=CHECK0 %s
22 ; RUN: llvm-dis -o - %t1 | FileCheck --check-prefix=CHECK1 %s
33
4 ; CHECK0-DAG: @afoo = alias [2 x i8*]* @foo
4 ; CHECK0-DAG: @afoo = alias [2 x i8*], [2 x i8*]* @foo
55 ; CHECK1-DAG: @afoo = external global [2 x i8*]
6 @afoo = alias [2 x i8*]* @foo
6 @afoo = alias [2 x i8*], [2 x i8*]* @foo
77
88 ; CHECK0-DAG: declare void @abar()
9 ; CHECK1-DAG: @abar = alias void ()* @bar
10 @abar = alias void ()* @bar
9 ; CHECK1-DAG: @abar = alias void (), void ()* @bar
10 @abar = alias void (), void ()* @bar
1111
1212 @foo = global [2 x i8*] [i8* bitcast (void ()* @bar to i8*), i8* bitcast (void ()* @abar to i8*)]
1313