Home | History | Annotate | Download | only in ADCE
      1 ; RUN: opt < %s -adce -simplifycfg | llvm-dis	
      2 %FILE = type { i32, i8*, i8*, i8, i8, i32, i32, i32 }
      3 	%spec_fd_t = type { i32, i32, i32, i8* }
      4 @__iob = external global [20 x %FILE]		; <[20 x %FILE]*> [#uses=1]
      5 @dbglvl = global i32 4		; <i32*> [#uses=3]
      6 @spec_fd = external global [3 x %spec_fd_t]		; <[3 x %spec_fd_t]*> [#uses=4]
      7 @.LC9 = internal global [34 x i8] c"spec_read: fd=%d, > MAX_SPEC_FD!\0A\00"		; <[34 x i8]*> [#uses=1]
      8 @.LC10 = internal global [4 x i8] c"EOF\00"		; <[4 x i8]*> [#uses=1]
      9 @.LC11 = internal global [4 x i8] c"%d\0A\00"		; <[4 x i8]*> [#uses=1]
     10 @.LC12 = internal global [17 x i8] c"spec_getc: %d = \00"		; <[17 x i8]*> [#uses=1]
     11 
     12 declare i32 @fprintf(%FILE*, i8*, ...)
     13 
     14 declare void @exit(i32)
     15 
     16 declare i32 @remove(i8*)
     17 
     18 declare i32 @fputc(i32, %FILE*)
     19 
     20 declare i32 @fwrite(i8*, i32, i32, %FILE*)
     21 
     22 declare void @perror(i8*)
     23 
     24 define i32 @spec_getc(i32 %fd) {
     25 	%reg109 = load i32* @dbglvl		; <i32> [#uses=1]
     26 	%cond266 = icmp sle i32 %reg109, 4		; <i1> [#uses=1]
     27 	br i1 %cond266, label %bb3, label %bb2
     28 
     29 bb2:		; preds = %0
     30 	%cast273 = getelementptr [17 x i8]* @.LC12, i64 0, i64 0		; <i8*> [#uses=0]
     31 	br label %bb3
     32 
     33 bb3:		; preds = %bb2, %0
     34 	%cond267 = icmp sle i32 %fd, 3		; <i1> [#uses=1]
     35 	br i1 %cond267, label %bb5, label %bb4
     36 
     37 bb4:		; preds = %bb3
     38 	%reg111 = getelementptr [20 x %FILE]* @__iob, i64 0, i64 1, i32 3		; <i8*> [#uses=1]
     39 	%cast274 = getelementptr [34 x i8]* @.LC9, i64 0, i64 0		; <i8*> [#uses=0]
     40 	%cast282 = bitcast i8* %reg111 to %FILE*		; <%FILE*> [#uses=0]
     41 	call void @exit( i32 1 )
     42 	br label %UnifiedExitNode
     43 
     44 bb5:		; preds = %bb3
     45 	%reg107-idxcast1 = sext i32 %fd to i64		; <i64> [#uses=2]
     46 	%reg107-idxcast2 = sext i32 %fd to i64		; <i64> [#uses=1]
     47 	%reg1311 = getelementptr [3 x %spec_fd_t]* @spec_fd, i64 0, i64 %reg107-idxcast2		; <%spec_fd_t*> [#uses=1]
     48 	%idx1 = getelementptr [3 x %spec_fd_t]* @spec_fd, i64 0, i64 %reg107-idxcast1, i32 2		; <i32*> [#uses=1]
     49 	%reg1321 = load i32* %idx1		; <i32> [#uses=3]
     50 	%idx2 = getelementptr %spec_fd_t* %reg1311, i64 0, i32 1		; <i32*> [#uses=1]
     51 	%reg1331 = load i32* %idx2		; <i32> [#uses=1]
     52 	%cond270 = icmp slt i32 %reg1321, %reg1331		; <i1> [#uses=1]
     53 	br i1 %cond270, label %bb9, label %bb6
     54 
     55 bb6:		; preds = %bb5
     56 	%reg134 = load i32* @dbglvl		; <i32> [#uses=1]
     57 	%cond271 = icmp sle i32 %reg134, 4		; <i1> [#uses=1]
     58 	br i1 %cond271, label %bb8, label %bb7
     59 
     60 bb7:		; preds = %bb6
     61 	%cast277 = getelementptr [4 x i8]* @.LC10, i64 0, i64 0		; <i8*> [#uses=0]
     62 	br label %bb8
     63 
     64 bb8:		; preds = %bb7, %bb6
     65 	br label %UnifiedExitNode
     66 
     67 bb9:		; preds = %bb5
     68 	%reg107-idxcast3 = sext i32 %fd to i64		; <i64> [#uses=1]
     69 	%idx3 = getelementptr [3 x %spec_fd_t]* @spec_fd, i64 0, i64 %reg107-idxcast3, i32 3		; <i8**> [#uses=1]
     70 	%reg1601 = load i8** %idx3		; <i8*> [#uses=1]
     71 	%reg132-idxcast1 = sext i32 %reg1321 to i64		; <i64> [#uses=1]
     72 	%idx4 = getelementptr i8* %reg1601, i64 %reg132-idxcast1		; <i8*> [#uses=1]
     73 	%reg1621 = load i8* %idx4		; <i8> [#uses=2]
     74 	%cast108 = zext i8 %reg1621 to i64		; <i64> [#uses=0]
     75 	%reg157 = add i32 %reg1321, 1		; <i32> [#uses=1]
     76 	%idx5 = getelementptr [3 x %spec_fd_t]* @spec_fd, i64 0, i64 %reg107-idxcast1, i32 2		; <i32*> [#uses=1]
     77 	store i32 %reg157, i32* %idx5
     78 	%reg163 = load i32* @dbglvl		; <i32> [#uses=1]
     79 	%cond272 = icmp sle i32 %reg163, 4		; <i1> [#uses=1]
     80 	br i1 %cond272, label %bb11, label %bb10
     81 
     82 bb10:		; preds = %bb9
     83 	%cast279 = getelementptr [4 x i8]* @.LC11, i64 0, i64 0		; <i8*> [#uses=0]
     84 	br label %bb11
     85 
     86 bb11:		; preds = %bb10, %bb9
     87 	%cast291 = zext i8 %reg1621 to i32		; <i32> [#uses=1]
     88 	br label %UnifiedExitNode
     89 
     90 UnifiedExitNode:		; preds = %bb11, %bb8, %bb4
     91 	%UnifiedRetVal = phi i32 [ 42, %bb4 ], [ -1, %bb8 ], [ %cast291, %bb11 ]		; <i32> [#uses=1]
     92 	ret i32 %UnifiedRetVal
     93 }
     94 
     95 declare i32 @puts(i8*)
     96 
     97 declare i32 @printf(i8*, ...)
     98