xref: /llvm-project/llvm/test/Transforms/LoopRotate/PhiRename-1.ll (revision e730e7d2aa403cc87cc7ce9021ad035b385f4357)
1; RUN: opt < %s -passes=loop-rotate -verify-dom-info -verify-loop-info -verify-memoryssa -S | FileCheck %s
2; CHECK-NOT: [ {{.}}tmp224
3
4target 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"
5
6	%struct.FILE = type { ptr, i32, i32, i16, i16, %struct.__sbuf, i32, ptr, ptr, ptr, ptr, ptr, %struct.__sbuf, ptr, i32, [3 x i8], [1 x i8], %struct.__sbuf, i32, i64 }
7	%struct.Index_Map = type { i32, ptr }
8	%struct.Item = type { [4 x i16], ptr }
9	%struct.__sFILEX = type opaque
10	%struct.__sbuf = type { ptr, i32 }
11	%struct.dimension = type { ptr, %struct.Index_Map, ptr, i32, ptr }
12	%struct.item_set = type { i32, i32, ptr, [2 x ptr], ptr, ptr, ptr, ptr }
13	%struct.list = type { ptr, ptr }
14	%struct.mapping = type { ptr, i32, i32, i32, ptr }
15	%struct.nonterminal = type { ptr, i32, i32, i32, ptr, ptr }
16	%struct.operator = type { ptr, i8, i32, i32, i32, i32, ptr }
17	%struct.pattern = type { ptr, ptr, [2 x ptr] }
18	%struct.plank = type { ptr, ptr, i32 }
19	%struct.plankMap = type { ptr, i32, ptr }
20	%struct.rule = type { [4 x i16], i32, i32, i32, ptr, ptr, i8 }
21	%struct.stateMap = type { ptr, ptr, i32, ptr }
22	%struct.table = type { ptr, ptr, ptr, [2 x ptr], ptr }
23@outfile = external global ptr		; <ptr> [#uses=1]
24@str1 = external constant [11 x i8]		; <ptr> [#uses=1]
25@operators = weak global ptr null		; <ptr> [#uses=1]
26
27
28
29define i32 @opsOfArity(i32 %arity) {
30entry:
31	%arity_addr = alloca i32		; <ptr> [#uses=2]
32	%retval = alloca i32, align 4		; <ptr> [#uses=2]
33	%tmp = alloca i32, align 4		; <ptr> [#uses=2]
34	%c = alloca i32, align 4		; <ptr> [#uses=4]
35	%l = alloca ptr, align 4		; <ptr> [#uses=5]
36	%op = alloca ptr, align 4		; <ptr> [#uses=3]
37	store i32 %arity, ptr %arity_addr
38	store i32 0, ptr %c
39	%tmp1 = load ptr, ptr @operators		; <ptr> [#uses=1]
40	store ptr %tmp1, ptr %l
41	br label %bb21
42
43bb:		; preds = %bb21
44	%tmp3 = getelementptr %struct.list, ptr %tmp22, i32 0, i32 0		; <ptr> [#uses=1]
45	%tmp4 = load ptr, ptr %tmp3		; <ptr> [#uses=1]
46	store ptr %tmp4, ptr %op
47	%tmp6 = load ptr, ptr %op		; <ptr> [#uses=1]
48	%tmp7 = getelementptr %struct.operator, ptr %tmp6, i32 0, i32 5		; <ptr> [#uses=1]
49	%tmp8 = load i32, ptr %tmp7		; <i32> [#uses=1]
50	%tmp9 = load i32, ptr %arity_addr		; <i32> [#uses=1]
51	icmp eq i32 %tmp8, %tmp9		; <i1>:0 [#uses=1]
52	zext i1 %0 to i8		; <i8>:1 [#uses=1]
53	icmp ne i8 %1, 0		; <i1>:2 [#uses=1]
54	br i1 %2, label %cond_true, label %cond_next
55
56cond_true:		; preds = %bb
57	%tmp10 = load ptr, ptr %op		; <ptr> [#uses=1]
58	%tmp11 = getelementptr %struct.operator, ptr %tmp10, i32 0, i32 2		; <ptr> [#uses=1]
59	%tmp12 = load i32, ptr %tmp11		; <i32> [#uses=1]
60	%tmp13 = load ptr, ptr @outfile		; <ptr> [#uses=1]
61	%tmp14 = getelementptr [11 x i8], ptr @str1, i32 0, i32 0		; <ptr> [#uses=1]
62	%tmp15 = call i32 (ptr, ptr, ...) @fprintf( ptr %tmp13, ptr %tmp14, i32 %tmp12 )		; <i32> [#uses=0]
63	%tmp16 = load i32, ptr %c		; <i32> [#uses=1]
64	%tmp17 = add i32 %tmp16, 1		; <i32> [#uses=1]
65	store i32 %tmp17, ptr %c
66	br label %cond_next
67
68cond_next:		; preds = %cond_true, %bb
69	%tmp19 = getelementptr %struct.list, ptr %tmp22, i32 0, i32 1		; <ptr> [#uses=1]
70	%tmp20 = load ptr, ptr %tmp19		; <ptr> [#uses=1]
71	store ptr %tmp20, ptr %l
72	br label %bb21
73
74bb21:		; preds = %cond_next, %entry
75        %l.in = phi ptr [ @operators, %entry ], [ %tmp19, %cond_next ]
76	%tmp22 = load ptr, ptr %l.in		; <ptr> [#uses=1]
77	icmp ne ptr %tmp22, null		; <i1>:3 [#uses=1]
78	zext i1 %3 to i8		; <i8>:4 [#uses=1]
79	icmp ne i8 %4, 0		; <i1>:5 [#uses=1]
80	br i1 %5, label %bb, label %bb23
81
82bb23:		; preds = %bb21
83	%tmp24 = load i32, ptr %c		; <i32> [#uses=1]
84	store i32 %tmp24, ptr %tmp
85	%tmp25 = load i32, ptr %tmp		; <i32> [#uses=1]
86	store i32 %tmp25, ptr %retval
87	br label %return
88
89return:		; preds = %bb23
90	%retval26 = load i32, ptr %retval		; <i32> [#uses=1]
91	ret i32 %retval26
92}
93
94declare i32 @fprintf(ptr, ptr, ...)
95