xref: /llvm-project/llvm/test/CodeGen/X86/2008-09-29-ReMatBug.ll (revision 2f448bf509432c1a19ec46ab8cbc7353c03c6280)
1; RUN: llc < %s -mtriple=i386-apple-darwin -relocation-model=pic -frame-pointer=all
2
3	%struct..0objc_selector = type opaque
4	%struct.NSString = type opaque
5	%struct.XCStringList = type { i32, ptr }
6	%struct._XCStringListNode = type { [3 x i8], [0 x i8], i8 }
7	%struct.__builtin_CFString = type { ptr, i32, ptr, i32 }
8@0 = internal constant %struct.__builtin_CFString { ptr @__CFConstantStringClassReference, i32 1992, ptr @"\01LC", i32 2 }		; <ptr>:0 [#uses=1]
9@__CFConstantStringClassReference = external global [0 x i32]		; <ptr> [#uses=1]
10@"\01LC" = internal constant [3 x i8] c"NO\00"		; <ptr> [#uses=1]
11@"\01LC1" = internal constant [1 x i8] zeroinitializer		; <ptr> [#uses=1]
12@llvm.used1 = appending global [1 x ptr] [ ptr @"-[XCStringList stringRepresentation]" ], section "llvm.metadata"		; <ptr> [#uses=0]
13
14define ptr @"-[XCStringList stringRepresentation]"(ptr %self, ptr %_cmd) nounwind {
15entry:
16	%0 = load i32, ptr null, align 4		; <i32> [#uses=1]
17	%1 = and i32 %0, 16777215		; <i32> [#uses=1]
18	%2 = icmp eq i32 %1, 0		; <i1> [#uses=1]
19	br i1 %2, label %bb44, label %bb4
20
21bb4:		; preds = %entry
22	%3 = load ptr, ptr null, align 4		; <ptr> [#uses=2]
23	%4 = icmp eq ptr %3, null		; <i1> [#uses=1]
24	br label %bb37.outer
25
26bb6:		; preds = %bb37
27	br label %bb19
28
29bb19:		; preds = %bb37, %bb6
30	%.rle = phi i32 [ 0, %bb6 ], [ %9, %bb37 ]		; <i32> [#uses=1]
31	%bufptr.0.lcssa = phi ptr [ null, %bb6 ], [ null, %bb37 ]		; <ptr> [#uses=2]
32	%5 = and i32 %.rle, 16777215		; <i32> [#uses=1]
33	%6 = icmp eq i32 %5, 0		; <i1> [#uses=1]
34	br i1 %6, label %bb25.split, label %bb37
35
36bb25.split:		; preds = %bb19
37	call void @foo(ptr @"\01LC1") nounwind nounwind
38	br label %bb35.outer
39
40bb34:		; preds = %bb35, %bb35, %bb35, %bb35
41	%7 = getelementptr i8, ptr %bufptr.0.lcssa, i32 %totalLength.0.ph		; <ptr> [#uses=1]
42	store i8 92, ptr %7, align 1
43	br label %bb35.outer
44
45bb35.outer:		; preds = %bb34, %bb25.split
46	%totalLength.0.ph = add i32 0, %totalLength.1.ph		; <i32> [#uses=2]
47	br label %bb35
48
49bb35:		; preds = %bb35, %bb35.outer
50	%8 = load i8, ptr null, align 1		; <i8> [#uses=1]
51	switch i8 %8, label %bb35 [
52		i8 0, label %bb37.outer
53		i8 32, label %bb34
54		i8 92, label %bb34
55		i8 34, label %bb34
56		i8 39, label %bb34
57	]
58
59bb37.outer:		; preds = %bb35, %bb4
60	%totalLength.1.ph = phi i32 [ 0, %bb4 ], [ %totalLength.0.ph, %bb35 ]		; <i32> [#uses=1]
61	%bufptr.1.ph = phi ptr [ null, %bb4 ], [ %bufptr.0.lcssa, %bb35 ]		; <ptr> [#uses=2]
62	br i1 %4, label %bb39.split, label %bb37
63
64bb37:		; preds = %bb37.outer, %bb19
65	%9 = load i32, ptr %3, align 4		; <i32> [#uses=1]
66	br i1 false, label %bb6, label %bb19
67
68bb39.split:		; preds = %bb37.outer
69	%10 = icmp eq ptr null, %bufptr.1.ph		; <i1> [#uses=1]
70	br i1 %10, label %bb44, label %bb42
71
72bb42:		; preds = %bb39.split
73	call void @quux(ptr %bufptr.1.ph) nounwind nounwind
74	ret ptr null
75
76bb44:		; preds = %bb39.split, %entry
77	%.0 = phi ptr [ @0, %entry ], [ null, %bb39.split ]		; <ptr> [#uses=1]
78	ret ptr %.0
79}
80
81declare void @foo(ptr)
82
83declare void @quux(ptr)
84