compiler: fix const complex numbers

This led to an assertion failure with a debug build of LLVM, but
apparently worked with a release build of LLVM.
Этот коммит содержится в:
Ayke van Laethem 2018-10-24 23:24:11 +02:00
родитель cb0a148cd7
коммит fcd44c02cd
Не найден ключ, соответствующий данной подписи
Идентификатор ключа GPG: E97FF5335DFDFDED

Просмотреть файл

@ -3155,8 +3155,8 @@ func (c *Compiler) parseConst(prefix string, expr *ssa.Const) (llvm.Value, error
return llvm.Value{}, err
}
cplx := llvm.Undef(llvm.VectorType(c.ctx.DoubleType(), 2))
cplx = c.builder.CreateInsertValue(cplx, r, 0, "")
cplx = c.builder.CreateInsertValue(cplx, i, 1, "")
cplx = c.builder.CreateInsertElement(cplx, r, llvm.ConstInt(c.ctx.Int8Type(), 0, false), "")
cplx = c.builder.CreateInsertElement(cplx, i, llvm.ConstInt(c.ctx.Int8Type(), 1, false), "")
return cplx, nil
} else {
return llvm.Value{}, errors.New("todo: unknown constant: " + expr.String())