; RUN: llvm-as < %s | llc -march=arm
-%str = internal constant [4 x sbyte] c"%d\0A\00" ; <[4 x sbyte]*> [#uses=1]
+%str = internal constant [7 x ubyte] c"%d %d\0A\00" ; <[7 x ubyte]*> [#uses=1]
implementation ; Functions:
void %f(int %a, ...) {
entry:
- %va = alloca sbyte*, align 4 ; <sbyte**> [#uses=4]
- call void %llvm.va_start( sbyte** %va )
- br label %bb
+ %a = cast int %a to uint ; <uint> [#uses=1]
+ %l1 = alloca sbyte*, align 4 ; <sbyte**> [#uses=5]
+ %l2 = alloca sbyte*, align 4 ; <sbyte**> [#uses=4]
+ %memtmp = alloca sbyte* ; <sbyte**> [#uses=2]
+ call void %llvm.va_start( sbyte** %l1 )
+ %tmp22 = seteq int %a, 0 ; <bool> [#uses=1]
+ %tmp23 = volatile load sbyte** %l1 ; <sbyte*> [#uses=2]
+ br bool %tmp22, label %bb8, label %bb
bb: ; preds = %bb, %entry
- %a_addr.0 = phi int [ %a, %entry ], [ %tmp5, %bb ] ; <int> [#uses=2]
- %tmp = volatile load sbyte** %va ; <sbyte*> [#uses=2]
- %tmp2 = getelementptr sbyte* %tmp, int 4 ; <sbyte*> [#uses=1]
- volatile store sbyte* %tmp2, sbyte** %va
- %tmp5 = add int %a_addr.0, -1 ; <int> [#uses=1]
- %tmp = seteq int %a_addr.0, 1 ; <bool> [#uses=1]
- br bool %tmp, label %bb7, label %bb
-
-bb7: ; preds = %bb
- %tmp3 = cast sbyte* %tmp to int* ; <int*> [#uses=1]
+ %indvar = phi uint [ 0, %entry ], [ %indvar.next, %bb ] ; <uint> [#uses=1]
+ %tmp.0 = phi sbyte* [ %tmp23, %entry ], [ %tmp, %bb ] ; <sbyte*> [#uses=2]
+ %tmp2 = getelementptr sbyte* %tmp.0, int 4 ; <sbyte*> [#uses=1]
+ volatile store sbyte* %tmp2, sbyte** %l1
+ %tmp3 = cast sbyte* %tmp.0 to int* ; <int*> [#uses=1]
%tmp = load int* %tmp3 ; <int> [#uses=1]
- %tmp10 = call int (sbyte*, ...)* %printf( sbyte* getelementptr ([4 x sbyte]* %str, int 0, uint 0), int %tmp ) ; <int> [#uses=0]
- call void %llvm.va_end( sbyte** %va )
+ %tmp = volatile load sbyte** %l1 ; <sbyte*> [#uses=2]
+ %indvar.next = add uint %indvar, 1 ; <uint> [#uses=2]
+ %exitcond = seteq uint %indvar.next, %a ; <bool> [#uses=1]
+ br bool %exitcond, label %bb8, label %bb
+
+bb8: ; preds = %bb, %entry
+ %p1.0.1 = phi int [ undef, %entry ], [ %tmp, %bb ] ; <int> [#uses=1]
+ %tmp.1 = phi sbyte* [ %tmp23, %entry ], [ %tmp, %bb ] ; <sbyte*> [#uses=1]
+ store sbyte* %tmp.1, sbyte** %memtmp
+ call void %llvm.va_copy( sbyte** %l2, sbyte** %memtmp )
+ %tmp10 = volatile load sbyte** %l2 ; <sbyte*> [#uses=2]
+ %tmp12 = getelementptr sbyte* %tmp10, int 4 ; <sbyte*> [#uses=1]
+ volatile store sbyte* %tmp12, sbyte** %l2
+ %tmp13 = cast sbyte* %tmp10 to int* ; <int*> [#uses=1]
+ %tmp14 = load int* %tmp13 ; <int> [#uses=1]
+ %tmp17 = call int (ubyte*, ...)* %printf( ubyte* getelementptr ([7 x ubyte]* %str, int 0, uint 0), int %p1.0.1, int %tmp14 ) ; <int> [#uses=0]
+ call void %llvm.va_end( sbyte** %l1 )
+ call void %llvm.va_end( sbyte** %l2 )
ret void
}
declare void %llvm.va_start(sbyte**)
-declare int %printf(sbyte*, ...)
+declare void %llvm.va_copy(sbyte**, sbyte**)
+
+declare int %printf(ubyte*, ...)
declare void %llvm.va_end(sbyte**)