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?
Этот коммит содержится в:
родитель
0b8beb77c1
коммит
cb0a148cd7
1 изменённых файлов: 8 добавлений и 4 удалений
|
@ -69,10 +69,14 @@ 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) {
|
||||||
switch use.CalledValue() {
|
if use := use.IsACallInst(); !use.IsNil() {
|
||||||
case hashmapBinarySet, hashmapStringSet:
|
switch use.CalledValue() {
|
||||||
updateInsts = append(updateInsts, use)
|
case hashmapBinarySet, hashmapStringSet:
|
||||||
default:
|
updateInsts = append(updateInsts, use)
|
||||||
|
default:
|
||||||
|
unknownUses = true
|
||||||
|
}
|
||||||
|
} else {
|
||||||
unknownUses = true
|
unknownUses = true
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Загрузка…
Создание таблицы
Сослаться в новой задаче