compiler: fix interface lowering pass

It was removing some globals that still had uses left.
This commit is contained in:
Ayke van Laethem
2019-04-15 15:33:18 +02:00
committed by Ron Evans
parent 7de3d4be2b
commit 7bcabe53ca
+7 -1
View File
@@ -440,12 +440,18 @@ func (p *lowerInterfacesPass) run() {
// numbers.
for _, typ := range p.types {
for _, use := range getUses(typ.typecode) {
if use.IsConstant() && use.Opcode() == llvm.PtrToInt {
if !use.IsAConstantExpr().IsNil() && use.Opcode() == llvm.PtrToInt {
use.ReplaceAllUsesWith(llvm.ConstInt(p.uintptrType, typ.num, false))
}
}
}
// Remove stray runtime.typeInInterface globals. Required for the following
// cleanup.
for _, global := range typesInInterfaces {
global.EraseFromParentAsGlobal()
}
// Remove method sets of types. Unnecessary, but cleans up the IR for
// inspection.
for _, typ := range p.types {