merge upstream

This commit is contained in:
xushiwei
2024-06-17 19:33:27 +08:00
8 changed files with 188 additions and 114 deletions

View File

@@ -757,10 +757,14 @@ func (p *context) compileInstrOrValue(b llssa.Builder, iv instrOrValue, asValue
case *ssa.Index:
x := p.compileValue(b, v.X)
idx := p.compileValue(b, v.Index)
ret = b.Index(x, idx, func(e llssa.Expr) (ret llssa.Expr) {
ret = b.Index(x, idx, func(e llssa.Expr) (ret llssa.Expr, zero bool) {
if e == x {
if n, ok := v.X.(*ssa.UnOp); ok {
return p.compileValue(b, n.X)
switch n := v.X.(type) {
case *ssa.Const:
zero = true
return
case *ssa.UnOp:
return p.compileValue(b, n.X), false
}
}
panic(fmt.Errorf("todo: addr of %v", e))