mirror of
https://github.com/tinygo-org/tinygo.git
synced 2026-08-25 14:59:05 +00:00
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?
This commit is contained in:
@@ -69,12 +69,16 @@ func (c *Compiler) OptimizeMaps() {
|
|||||||
unknownUses := false // are there any uses other than setting a value?
|
unknownUses := false // are there any uses other than setting a value?
|
||||||
|
|
||||||
for _, use := range getUses(makeInst) {
|
for _, use := range getUses(makeInst) {
|
||||||
|
if use := use.IsACallInst(); !use.IsNil() {
|
||||||
switch use.CalledValue() {
|
switch use.CalledValue() {
|
||||||
case hashmapBinarySet, hashmapStringSet:
|
case hashmapBinarySet, hashmapStringSet:
|
||||||
updateInsts = append(updateInsts, use)
|
updateInsts = append(updateInsts, use)
|
||||||
default:
|
default:
|
||||||
unknownUses = true
|
unknownUses = true
|
||||||
}
|
}
|
||||||
|
} else {
|
||||||
|
unknownUses = true
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if !unknownUses {
|
if !unknownUses {
|
||||||
|
|||||||
Reference in New Issue
Block a user