mirror of
https://github.com/tinygo-org/tinygo.git
synced 2026-07-26 06:38:42 +00:00
transform: fix non-determinism in the interface lowering pass
This non-determinism was introduced in https://github.com/tinygo-org/tinygo/pull/2640. Non-determinism in the compiler is a bug because it makes it harder to find whether a compiler change actually affected the binary. Fixes https://github.com/tinygo-org/tinygo/issues/3504
This commit is contained in:
committed by
Ron Evans
parent
1cce1ea423
commit
517098c468
@@ -302,10 +302,18 @@ func (p *lowerInterfacesPass) run() error {
|
||||
use.EraseFromParentAsInstruction()
|
||||
}
|
||||
|
||||
// Create a sorted list of type names, for predictable iteration.
|
||||
var typeNames []string
|
||||
for name := range p.types {
|
||||
typeNames = append(typeNames, name)
|
||||
}
|
||||
sort.Strings(typeNames)
|
||||
|
||||
// Remove all method sets, which are now unnecessary and inhibit later
|
||||
// optimizations if they are left in place.
|
||||
zero := llvm.ConstInt(p.ctx.Int32Type(), 0, false)
|
||||
for _, t := range p.types {
|
||||
for _, name := range typeNames {
|
||||
t := p.types[name]
|
||||
if !t.methodSet.IsNil() {
|
||||
initializer := t.typecode.Initializer()
|
||||
var newInitializerFields []llvm.Value
|
||||
|
||||
Reference in New Issue
Block a user