From fcd44c02cdd74a09fb005b389c5e20b546bf5bf4 Mon Sep 17 00:00:00 2001 From: Ayke van Laethem Date: Wed, 24 Oct 2018 23:24:11 +0200 Subject: [PATCH] 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. --- compiler/compiler.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/compiler/compiler.go b/compiler/compiler.go index d04f883a..04d5ffca 100644 --- a/compiler/compiler.go +++ b/compiler/compiler.go @@ -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())