Generate phi node for default case in match switch

This commit is contained in:
Sasha Koshka 2024-03-06 13:09:20 -05:00
parent 7154f5d333
commit 2f251b8274

View File

@ -150,6 +150,12 @@ func (this *generator) generateMatch (match *entity.Match, mode resultMode) (llv
if mode == resultModeAny {
return nil, false, nil
} else {
irType, err := this.generateType(match.Type())
if err != nil { return nil, false, err }
irIncomings = append(irIncomings, &llvm.Incoming {
X: llvm.NewConstZeroInitializer(irType),
Predecessor: previousBlock,
})
return this.blockManager.NewPhi(irIncomings...), loc, nil
}
}