ssa: fix multi result
This commit is contained in:
@@ -370,8 +370,13 @@ source_filename = "foo/bar"
|
||||
|
||||
define { i64, double } @fn(double %0) {
|
||||
_llgo_0:
|
||||
%mrv = insertvalue { i64, double } { ptr @a, double poison }, double %0, 1
|
||||
ret { i64, double } %mrv
|
||||
%1 = alloca { i64, double }, align 8
|
||||
%2 = getelementptr inbounds { i64, double }, ptr %1, i32 0, i32 0
|
||||
store ptr @a, ptr %2, align 8
|
||||
%3 = getelementptr inbounds { i64, double }, ptr %1, i32 0, i32 1
|
||||
store double %0, ptr %3, align 8
|
||||
%4 = load { i64, double }, ptr %1, align 8
|
||||
ret { i64, double } %4
|
||||
}
|
||||
`)
|
||||
}
|
||||
|
||||
@@ -177,7 +177,14 @@ func (b Builder) Return(results ...Expr) {
|
||||
b.impl.CreateRet(ret.impl)
|
||||
default:
|
||||
tret := b.Func.raw.Type.(*types.Signature).Results()
|
||||
b.impl.CreateAggregateRet(llvmParams(0, results, tret, b))
|
||||
n := tret.Len()
|
||||
typs := make([]Type, n)
|
||||
for i := 0; i < n; i++ {
|
||||
typs[i] = b.Prog.Type(tret.At(i).Type(), InC)
|
||||
}
|
||||
typ := b.Prog.Struct(typs...)
|
||||
expr := b.aggregateValue(typ, llvmParams(0, results, tret, b)...)
|
||||
b.impl.CreateRet(expr.impl)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user