[llvm-commits] test/C++Frontend/2008-02-13-sret.cpp

Duncan Sands baldrick at free.fr
Thu Feb 14 06:52:26 PST 2008


Hi Dale, this test is failing for me (x86-32 linux):
there is nothing called retval.

// RUN: %llvmgxx -S -O0 -emit-llvm %s -o - | grep retval | grep S242 | grep {i32 1} | count 2

Ciao,

Duncan.

; ModuleID = '2008-02-13-sret.cpp'
target 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-f80:32:32"
target triple = "i686-pc-linux-gnu"
	%struct.S242 = type { i8*, [1 x i32] }
	%struct.S92 = type <{ i16, [2 x i8] }>
	%struct.S93 = type { i8*, [1 x i32] }
@s242 = external global %struct.S242		; <%struct.S242*> [#uses=2]
@s93 = external global %struct.S242		; <%struct.S242*> [#uses=1]
@s92 = external global %struct.S92		; <%struct.S92*> [#uses=1]

define void @_Z7check92v(%struct.S92* sret  %agg.result) {
entry:
	%ret = alloca %struct.S92, align 4		; <%struct.S92*> [#uses=0]
	%memtmp = alloca %struct.S92, align 8		; <%struct.S92*> [#uses=2]
	%"alloca point" = bitcast i32 0 to i32		; <i32> [#uses=0]
	%agg.result1 = bitcast %struct.S92* %agg.result to i8*		; <i8*> [#uses=1]
	%tmp = call i8* @_Z6memsetPvim( i8* %agg.result1, i32 0, i32 4 )		; <i8*> [#uses=0]
	%tmp2 = getelementptr %struct.S92* @s92, i32 0, i32 0		; <i16*> [#uses=1]
	%tmp3 = load i16* %tmp2, align 1		; <i16> [#uses=1]
	%tmp4 = shl i16 %tmp3, 2		; <i16> [#uses=1]
	%tmp5 = ashr i16 %tmp4, 2		; <i16> [#uses=1]
	%tmp6 = getelementptr %struct.S92* %agg.result, i32 0, i32 0		; <i16*> [#uses=2]
	%tmp7 = load i16* %tmp6, align 1		; <i16> [#uses=1]
	%tmp8 = and i16 %tmp5, 16383		; <i16> [#uses=1]
	%tmp9 = and i16 %tmp7, -16384		; <i16> [#uses=1]
	%tmp10 = or i16 %tmp9, %tmp8		; <i16> [#uses=1]
	store i16 %tmp10, i16* %tmp6, align 1
	%tmp11 = getelementptr %struct.S92* %memtmp, i32 0, i32 0		; <i16*> [#uses=1]
	%tmp12 = getelementptr %struct.S92* %agg.result, i32 0, i32 0		; <i16*> [#uses=1]
	%tmp13 = load i16* %tmp12, align 4		; <i16> [#uses=1]
	store i16 %tmp13, i16* %tmp11, align 4
	%tmp14 = getelementptr %struct.S92* %memtmp, i32 0, i32 1		; <[2 x i8]*> [#uses=2]
	%tmp15 = getelementptr %struct.S92* %agg.result, i32 0, i32 1		; <[2 x i8]*> [#uses=2]
	%tmp16 = getelementptr [2 x i8]* %tmp14, i32 0, i32 0		; <i8*> [#uses=1]
	%tmp17 = getelementptr [2 x i8]* %tmp15, i32 0, i32 0		; <i8*> [#uses=1]
	%tmp18 = load i8* %tmp17, align 2		; <i8> [#uses=1]
	store i8 %tmp18, i8* %tmp16, align 2
	%tmp19 = getelementptr [2 x i8]* %tmp14, i32 0, i32 1		; <i8*> [#uses=1]
	%tmp20 = getelementptr [2 x i8]* %tmp15, i32 0, i32 1		; <i8*> [#uses=1]
	%tmp21 = load i8* %tmp20, align 1		; <i8> [#uses=1]
	store i8 %tmp21, i8* %tmp19, align 1
	br label %return

return:		; preds = %entry
	ret void
}

define void @_Z10check242vaiz(i32 %z, ...) {
entry:
	%z_addr = alloca i32		; <i32*> [#uses=1]
	%ap = alloca i8*		; <i8**> [#uses=4]
	%arg = alloca %struct.S242		; <%struct.S242*> [#uses=2]
	%tmp = alloca %struct.S242		; <%struct.S242*> [#uses=4]
	%ap.2 = alloca i8*		; <i8**> [#uses=3]
	%"alloca point" = bitcast i32 0 to i32		; <i32> [#uses=0]
	store i32 %z, i32* %z_addr
	%ap1 = bitcast i8** %ap to i8*		; <i8*> [#uses=1]
	call void @llvm.va_start( i8* %ap1 )
	%tmp2 = load i8** %ap, align 4		; <i8*> [#uses=1]
	store i8* %tmp2, i8** %ap.2, align 4
	%tmp3 = load i8** %ap.2, align 4		; <i8*> [#uses=1]
	%tmp4 = getelementptr i8* %tmp3, i64 8		; <i8*> [#uses=1]
	store i8* %tmp4, i8** %ap, align 4
	%tmp5 = load i8** %ap.2, align 4		; <i8*> [#uses=1]
	%tmp56 = bitcast i8* %tmp5 to %struct.S242*		; <%struct.S242*> [#uses=2]
	%tmp7 = getelementptr %struct.S242* %tmp, i32 0, i32 0		; <i8**> [#uses=1]
	%tmp8 = getelementptr %struct.S242* %tmp56, i32 0, i32 0		; <i8**> [#uses=1]
	%tmp9 = load i8** %tmp8, align 4		; <i8*> [#uses=1]
	store i8* %tmp9, i8** %tmp7, align 4
	%tmp10 = getelementptr %struct.S242* %tmp, i32 0, i32 1		; <[1 x i32]*> [#uses=1]
	%tmp11 = getelementptr %struct.S242* %tmp56, i32 0, i32 1		; <[1 x i32]*> [#uses=1]
	%tmp12 = getelementptr [1 x i32]* %tmp10, i32 0, i32 0		; <i32*> [#uses=1]
	%tmp13 = getelementptr [1 x i32]* %tmp11, i32 0, i32 0		; <i32*> [#uses=1]
	%tmp14 = load i32* %tmp13, align 4		; <i32> [#uses=1]
	store i32 %tmp14, i32* %tmp12, align 4
	%tmp15 = getelementptr %struct.S242* %arg, i32 0, i32 0		; <i8**> [#uses=1]
	%tmp16 = getelementptr %struct.S242* %tmp, i32 0, i32 0		; <i8**> [#uses=1]
	%tmp17 = load i8** %tmp16, align 4		; <i8*> [#uses=1]
	store i8* %tmp17, i8** %tmp15, align 4
	%tmp18 = getelementptr %struct.S242* %arg, i32 0, i32 1		; <[1 x i32]*> [#uses=1]
	%tmp19 = getelementptr %struct.S242* %tmp, i32 0, i32 1		; <[1 x i32]*> [#uses=1]
	%tmp20 = getelementptr [1 x i32]* %tmp18, i32 0, i32 0		; <i32*> [#uses=1]
	%tmp21 = getelementptr [1 x i32]* %tmp19, i32 0, i32 0		; <i32*> [#uses=1]
	%tmp22 = load i32* %tmp21, align 4		; <i32> [#uses=1]
	store i32 %tmp22, i32* %tmp20, align 4
	%ap23 = bitcast i8** %ap to i8*		; <i8*> [#uses=1]
	call void @llvm.va_end( i8* %ap23 )
	br label %return

return:		; preds = %entry
	ret void
}

declare void @llvm.va_start(i8*) nounwind 

declare void @llvm.va_end(i8*) nounwind 

define void @_Z9check93vaiz(i32 %z, ...) {
entry:
	%z_addr = alloca i32		; <i32*> [#uses=1]
	%ap = alloca i8*		; <i8**> [#uses=4]
	%arg = alloca %struct.S242, align 8		; <%struct.S242*> [#uses=2]
	%tmp = alloca %struct.S242, align 8		; <%struct.S242*> [#uses=4]
	%ap.0 = alloca i8*		; <i8**> [#uses=3]
	%"alloca point" = bitcast i32 0 to i32		; <i32> [#uses=0]
	store i32 %z, i32* %z_addr
	%ap1 = bitcast i8** %ap to i8*		; <i8*> [#uses=1]
	call void @llvm.va_start( i8* %ap1 )
	%tmp2 = load i8** %ap, align 4		; <i8*> [#uses=1]
	store i8* %tmp2, i8** %ap.0, align 4
	%tmp3 = load i8** %ap.0, align 4		; <i8*> [#uses=1]
	%tmp4 = getelementptr i8* %tmp3, i64 8		; <i8*> [#uses=1]
	store i8* %tmp4, i8** %ap, align 4
	%tmp5 = load i8** %ap.0, align 4		; <i8*> [#uses=1]
	%tmp56 = bitcast i8* %tmp5 to %struct.S242*		; <%struct.S242*> [#uses=2]
	%tmp7 = getelementptr %struct.S242* %tmp, i32 0, i32 0		; <i8**> [#uses=1]
	%tmp8 = getelementptr %struct.S242* %tmp56, i32 0, i32 0		; <i8**> [#uses=1]
	%tmp9 = load i8** %tmp8, align 4		; <i8*> [#uses=1]
	store i8* %tmp9, i8** %tmp7, align 4
	%tmp10 = getelementptr %struct.S242* %tmp, i32 0, i32 1		; <[1 x i32]*> [#uses=1]
	%tmp11 = getelementptr %struct.S242* %tmp56, i32 0, i32 1		; <[1 x i32]*> [#uses=1]
	%tmp12 = getelementptr [1 x i32]* %tmp10, i32 0, i32 0		; <i32*> [#uses=1]
	%tmp13 = getelementptr [1 x i32]* %tmp11, i32 0, i32 0		; <i32*> [#uses=1]
	%tmp14 = load i32* %tmp13, align 4		; <i32> [#uses=1]
	store i32 %tmp14, i32* %tmp12, align 4
	%tmp15 = getelementptr %struct.S242* %arg, i32 0, i32 0		; <i8**> [#uses=1]
	%tmp16 = getelementptr %struct.S242* %tmp, i32 0, i32 0		; <i8**> [#uses=1]
	%tmp17 = load i8** %tmp16, align 8		; <i8*> [#uses=1]
	store i8* %tmp17, i8** %tmp15, align 8
	%tmp18 = getelementptr %struct.S242* %arg, i32 0, i32 1		; <[1 x i32]*> [#uses=1]
	%tmp19 = getelementptr %struct.S242* %tmp, i32 0, i32 1		; <[1 x i32]*> [#uses=1]
	%tmp20 = getelementptr [1 x i32]* %tmp18, i32 0, i32 0		; <i32*> [#uses=1]
	%tmp21 = getelementptr [1 x i32]* %tmp19, i32 0, i32 0		; <i32*> [#uses=1]
	%tmp22 = load i32* %tmp21, align 4		; <i32> [#uses=1]
	store i32 %tmp22, i32* %tmp20, align 4
	%ap23 = bitcast i8** %ap to i8*		; <i8*> [#uses=1]
	call void @llvm.va_end( i8* %ap23 )
	br label %return

return:		; preds = %entry
	ret void
}

define void @_Z8check242v(%struct.S242* sret  %agg.result) {
entry:
	%ret = alloca %struct.S242		; <%struct.S242*> [#uses=0]
	%memtmp = alloca %struct.S242, align 8		; <%struct.S242*> [#uses=2]
	%"alloca point" = bitcast i32 0 to i32		; <i32> [#uses=0]
	%agg.result1 = bitcast %struct.S242* %agg.result to i8*		; <i8*> [#uses=1]
	%tmp = call i8* @_Z6memsetPvim( i8* %agg.result1, i32 0, i32 8 )		; <i8*> [#uses=0]
	%tmp2 = getelementptr %struct.S242* @s242, i32 0, i32 0		; <i8**> [#uses=1]
	%tmp3 = load i8** %tmp2, align 4		; <i8*> [#uses=1]
	%tmp4 = getelementptr %struct.S242* %agg.result, i32 0, i32 0		; <i8**> [#uses=1]
	store i8* %tmp3, i8** %tmp4, align 4
	%tmp5 = getelementptr %struct.S242* @s242, i32 0, i32 1		; <[1 x i32]*> [#uses=1]
	%tmp6 = getelementptr [1 x i32]* %tmp5, i32 0, i32 0		; <i32*> [#uses=1]
	%tmp7 = load i32* %tmp6, align 4		; <i32> [#uses=1]
	%tmp8 = getelementptr %struct.S242* %agg.result, i32 0, i32 1		; <[1 x i32]*> [#uses=1]
	%tmp9 = getelementptr [1 x i32]* %tmp8, i32 0, i32 0		; <i32*> [#uses=1]
	store i32 %tmp7, i32* %tmp9, align 4
	%tmp10 = getelementptr %struct.S242* %memtmp, i32 0, i32 0		; <i8**> [#uses=1]
	%tmp11 = getelementptr %struct.S242* %agg.result, i32 0, i32 0		; <i8**> [#uses=1]
	%tmp12 = load i8** %tmp11, align 4		; <i8*> [#uses=1]
	store i8* %tmp12, i8** %tmp10, align 4
	%tmp13 = getelementptr %struct.S242* %memtmp, i32 0, i32 1		; <[1 x i32]*> [#uses=1]
	%tmp14 = getelementptr %struct.S242* %agg.result, i32 0, i32 1		; <[1 x i32]*> [#uses=1]
	%tmp15 = getelementptr [1 x i32]* %tmp13, i32 0, i32 0		; <i32*> [#uses=1]
	%tmp16 = getelementptr [1 x i32]* %tmp14, i32 0, i32 0		; <i32*> [#uses=1]
	%tmp17 = load i32* %tmp16, align 4		; <i32> [#uses=1]
	store i32 %tmp17, i32* %tmp15, align 4
	br label %return

return:		; preds = %entry
	ret void
}

declare i8* @_Z6memsetPvim(i8*, i32, i32)

define void @_Z7check93v(%struct.S242* sret  %agg.result) {
entry:
	%ret = alloca %struct.S242, align 8		; <%struct.S242*> [#uses=0]
	%memtmp = alloca %struct.S242, align 8		; <%struct.S242*> [#uses=2]
	%"alloca point" = bitcast i32 0 to i32		; <i32> [#uses=0]
	%agg.result1 = bitcast %struct.S242* %agg.result to i8*		; <i8*> [#uses=1]
	%tmp = call i8* @_Z6memsetPvim( i8* %agg.result1, i32 0, i32 8 )		; <i8*> [#uses=0]
	%tmp2 = getelementptr %struct.S242* @s93, i32 0, i32 0		; <i8**> [#uses=1]
	%tmp3 = load i8** %tmp2, align 8		; <i8*> [#uses=1]
	%tmp4 = getelementptr %struct.S242* %agg.result, i32 0, i32 0		; <i8**> [#uses=1]
	store i8* %tmp3, i8** %tmp4, align 8
	%tmp5 = getelementptr %struct.S242* %memtmp, i32 0, i32 0		; <i8**> [#uses=1]
	%tmp6 = getelementptr %struct.S242* %agg.result, i32 0, i32 0		; <i8**> [#uses=1]
	%tmp7 = load i8** %tmp6, align 8		; <i8*> [#uses=1]
	store i8* %tmp7, i8** %tmp5, align 8
	%tmp8 = getelementptr %struct.S242* %memtmp, i32 0, i32 1		; <[1 x i32]*> [#uses=1]
	%tmp9 = getelementptr %struct.S242* %agg.result, i32 0, i32 1		; <[1 x i32]*> [#uses=1]
	%tmp10 = getelementptr [1 x i32]* %tmp8, i32 0, i32 0		; <i32*> [#uses=1]
	%tmp11 = getelementptr [1 x i32]* %tmp9, i32 0, i32 0		; <i32*> [#uses=1]
	%tmp12 = load i32* %tmp11, align 4		; <i32> [#uses=1]
	store i32 %tmp12, i32* %tmp10, align 4
	br label %return

return:		; preds = %entry
	ret void
}



More information about the llvm-commits mailing list