1 ; RUN: verify-uselistorder < %s -preserve-bc-use-list-order -num-shuffles=5
3 @a = global [4 x i1] [i1 0, i1 1, i1 0, i1 1]
4 @b = alias i1* getelementptr ([4 x i1]* @a, i64 0, i64 2)
6 ; Check use-list order of constants used by globals.
11 ; Check use-list order between variables and aliases.
12 @target = global i3 zeroinitializer
13 @alias1 = alias i3* @target
14 @alias2 = alias i3* @target
15 @alias3 = alias i3* @target
16 @var1 = global i3* @target
17 @var2 = global i3* @target
18 @var3 = global i3* @target
20 ; Check use-list order for a global when used both by a global and in a
22 @globalAndFunction = global i4 4
23 @globalAndFunctionGlobalUser = global i4* @globalAndFunction
25 ; Check use-list order for constants used by globals that are themselves used
26 ; as aliases. This confirms that this globals are recognized as GlobalValues
27 ; (not general constants).
28 @const.global = global i63 0
29 @const.global.ptr = global i63* @const.global
30 @const.global.2 = global i63 0
32 ; Same as above, but for aliases.
33 @const.target = global i62 1
34 @const.alias = alias i62* @const.target
35 @const.alias.ptr = alias i62* @const.alias
36 @const.alias.2 = alias i62* @const.target
38 define i64 @f(i64 %f) {
44 define i64 @g(i64 %g) {
50 define i64 @h(i64 %h) {
56 define i64 @i(i64 %i) {
62 define i64 @j(i64 %j) {
68 define i64 @k(i64 %k) {
74 define i64 @l(i64 %l) {
88 %a = load i1* getelementptr ([4 x i1]* @a, i64 0, i64 2)
92 define i32 @f32(i32 %a, i32 %b, i32 %c, i32 %d) {
98 %sum = add i32 %eh, %ef
102 %product = phi i32 [%ef, %first], [%sum, %second]
112 %gotosecond = icmp slt i32 %gh, -9
113 br i1 %gotosecond, label %second, label %exit
116 define i4 @globalAndFunctionFunctionUser() {
118 %local = load i4* @globalAndFunction
122 ; Check for when an instruction is its own user.
123 define void @selfUser() {
131 %var = phi i32 [ %var, %loop1 ], [ %var, %loop2 ]