Browse Source

compiler: fix map optimization

Not all uses of a map are call instructions. Don't assume they are.
TODO: investigate these uses and see whether they might be eliminated?
pull/55/head
Ayke van Laethem 6 years ago
parent
commit
cb0a148cd7
No known key found for this signature in database GPG Key ID: E97FF5335DFDFDED
  1. 12
      compiler/optimizer.go

12
compiler/optimizer.go

@ -69,10 +69,14 @@ func (c *Compiler) OptimizeMaps() {
unknownUses := false // are there any uses other than setting a value?
for _, use := range getUses(makeInst) {
switch use.CalledValue() {
case hashmapBinarySet, hashmapStringSet:
updateInsts = append(updateInsts, use)
default:
if use := use.IsACallInst(); !use.IsNil() {
switch use.CalledValue() {
case hashmapBinarySet, hashmapStringSet:
updateInsts = append(updateInsts, use)
default:
unknownUses = true
}
} else {
unknownUses = true
}
}

Loading…
Cancel
Save