brintos

brintos / llvm-project-archived public Read only

0
0
Text · 3.3 KiB · ec5f7ec Raw
169 lines · plain
1; RUN: verify-uselistorder < %s2 3@a = global [4 x i1] [i1 0, i1 1, i1 0, i1 1]4@b = alias i1, getelementptr ([4 x i1], [4 x i1]* @a, i64 0, i64 2)5 6; Check use-list order of constants used by globals.7@glob1 = global i5 78@glob2 = global i5 79@glob3 = global i5 710 11; Check use-list order between variables and aliases.12@target = global i3 zeroinitializer13@alias1 = alias i3, i3* @target14@alias2 = alias i3, i3* @target15@alias3 = alias i3, i3* @target16@var1 = global i3* @target17@var2 = global i3* @target18@var3 = global i3* @target19 20; Check use-list order for a global when used both by a global and in a21; function.22@globalAndFunction = global i4 423@globalAndFunctionGlobalUser = global i4* @globalAndFunction24 25; Check use-list order for constants used by globals that are themselves used26; as aliases.  This confirms that this globals are recognized as GlobalValues27; (not general constants).28@const.global = global i63 029@const.global.ptr = global i63* @const.global30@const.global.2 = global i63 031 32; Same as above, but for aliases.33@const.target = global i62 134@const.alias = alias i62, i62* @const.target35@const.alias.ptr = alias i62, i62* @const.alias36@const.alias.2 = alias i62, i62* @const.target37 38define i64 @f(i64 %f) {39entry:40  %sum = add i64 %f, 041  ret i64 %sum42}43 44define i64 @g(i64 %g) {45entry:46  %sum = add i64 %g, 047  ret i64 %sum48}49 50define i64 @h(i64 %h) {51entry:52  %sum = add i64 %h, 053  ret i64 %sum54}55 56define i64 @i(i64 %i) {57entry:58  %sum = add i64 %i, 159  ret i64 %sum60}61 62define i64 @j(i64 %j) {63entry:64  %sum = add i64 %j, 165  ret i64 %sum66}67 68define i64 @k(i64 %k) {69entry:70  %sum = add i64 %k, 171  ret i64 %sum72}73 74define i64 @l(i64 %l) {75entry:76  %sum = add i64 %l, 177  ret i64 %sum78}79 80define i1 @loadb() {81entry:82  %b = load i1, i1* @b83  ret i1 %b84}85 86define i1 @loada() {87entry:88  %a = load i1, i1* getelementptr ([4 x i1], [4 x i1]* @a, i64 0, i64 2)89  ret i1 %a90}91 92define i32 @f32(i32 %a, i32 %b, i32 %c, i32 %d) {93entry:94  br label %first95 96second:97  %eh = mul i32 %e, %h98  %sum = add i32 %eh, %ef99  br label %exit100 101exit:102  %product = phi i32 [%ef, %first], [%sum, %second]103  ret i32 %product104 105first:106  %e = add i32 %a, 7107  %f = add i32 %b, 7108  %g = add i32 %c, 8109  %h = add i32 %d, 8110  %ef = mul i32 %e, %f111  %gh = mul i32 %g, %h112  %gotosecond = icmp slt i32 %gh, -9113  br i1 %gotosecond, label %second, label %exit114}115 116define i4 @globalAndFunctionFunctionUser() {117entry:118  %local = load i4, i4* @globalAndFunction119  ret i4 %local120}121 122; Check for when an instruction is its own user.123define void @selfUser(i1 %a) {124entry:125  ret void126 127loop1:128  br label %loop2129 130loop2:131  %var = phi i32 [ %var, %loop1 ], [ %var, %loop2 ]132  br label %loop2133}134 135; Check that block addresses work.136@ba1 = constant i8* blockaddress (@bafunc1, %bb)137@ba2 = constant i8* getelementptr (i8, i8* blockaddress (@bafunc2, %bb), i61 0)138@ba3 = constant i8* getelementptr (i8, i8* blockaddress (@bafunc2, %bb), i61 0)139 140define i8* @babefore() {141  ret i8* getelementptr (i8, i8* blockaddress (@bafunc2, %bb), i61 0)142bb1:143  ret i8* blockaddress (@bafunc1, %bb)144bb2:145  ret i8* blockaddress (@bafunc3, %bb)146}147define void @bafunc1() {148  unreachable149bb:150  unreachable151}152define void @bafunc2() {153  unreachable154bb:155  unreachable156}157define void @bafunc3() {158  unreachable159bb:160  unreachable161}162define i8* @baafter() {163  ret i8* blockaddress (@bafunc2, %bb)164bb1:165  ret i8* blockaddress (@bafunc1, %bb)166bb2:167  ret i8* blockaddress (@bafunc3, %bb)168}169