@@ -304,7 +304,7 @@ func (p *lowerInterfacesPass) run() {
304
304
// interface value should already have returned false.
305
305
// Replace the function pointer with undef (which will then be
306
306
// called), indicating to the optimizer this code is unreachable.
307
- use .ReplaceAllUsesWith (llvm .Undef (p .i8ptrType ))
307
+ use .ReplaceAllUsesWith (llvm .Undef (p .uintptrType ))
308
308
use .EraseFromParentAsInstruction ()
309
309
} else if len (itf .types ) == 1 {
310
310
// There is only one implementation of the given type.
@@ -314,12 +314,12 @@ func (p *lowerInterfacesPass) run() {
314
314
// There are multiple types implementing this interface, thus there
315
315
// are multiple possible functions to call. Delegate calling the
316
316
// right function to a special wrapper function.
317
- bitcasts := getUses (use )
318
- if len (bitcasts ) != 1 || bitcasts [0 ].IsABitCastInst ().IsNil () {
319
- panic ("expected exactly one bitcast use of runtime.interfaceMethod" )
317
+ inttoptrs := getUses (use )
318
+ if len (inttoptrs ) != 1 || inttoptrs [0 ].IsAIntToPtrInst ().IsNil () {
319
+ panic ("expected exactly one inttoptr use of runtime.interfaceMethod" )
320
320
}
321
- bitcast := bitcasts [0 ]
322
- calls := getUses (bitcast )
321
+ inttoptr := inttoptrs [0 ]
322
+ calls := getUses (inttoptr )
323
323
if len (calls ) != 1 || calls [0 ].IsACallInst ().IsNil () {
324
324
panic ("expected exactly one call use of runtime.interfaceMethod" )
325
325
}
@@ -340,14 +340,14 @@ func (p *lowerInterfacesPass) run() {
340
340
// call, after selecting the right concrete type.
341
341
redirector := p .getInterfaceMethodFunc (itf , signature , call .Type (), paramTypes )
342
342
343
- // Replace the old lookup/bitcast /call with the new call.
343
+ // Replace the old lookup/inttoptr /call with the new call.
344
344
p .builder .SetInsertPointBefore (call )
345
345
retval := p .builder .CreateCall (redirector , params , "" )
346
346
if retval .Type ().TypeKind () != llvm .VoidTypeKind {
347
347
call .ReplaceAllUsesWith (retval )
348
348
}
349
349
call .EraseFromParentAsInstruction ()
350
- bitcast .EraseFromParentAsInstruction ()
350
+ inttoptr .EraseFromParentAsInstruction ()
351
351
use .EraseFromParentAsInstruction ()
352
352
}
353
353
}
@@ -542,22 +542,22 @@ func (p *lowerInterfacesPass) getSignature(name string) *signatureInfo {
542
542
return p .signatures [name ]
543
543
}
544
544
545
- // replaceInvokeWithCall replaces a runtime.interfaceMethod + bitcast with a
545
+ // replaceInvokeWithCall replaces a runtime.interfaceMethod + inttoptr with a
546
546
// concrete method. This can be done when only one type implements the
547
547
// interface.
548
548
func (p * lowerInterfacesPass ) replaceInvokeWithCall (use llvm.Value , typ * typeInfo , signature * signatureInfo ) {
549
- bitcasts := getUses (use )
550
- if len (bitcasts ) != 1 || bitcasts [0 ].IsABitCastInst ().IsNil () {
551
- panic ("expected exactly one bitcast use of runtime.interfaceMethod" )
549
+ inttoptrs := getUses (use )
550
+ if len (inttoptrs ) != 1 || inttoptrs [0 ].IsAIntToPtrInst ().IsNil () {
551
+ panic ("expected exactly one inttoptr use of runtime.interfaceMethod" )
552
552
}
553
- bitcast := bitcasts [0 ]
553
+ inttoptr := inttoptrs [0 ]
554
554
function := typ .getMethod (signature ).function
555
- if bitcast .Type () != function .Type () {
555
+ if inttoptr .Type () != function .Type () {
556
556
p .builder .SetInsertPointBefore (use )
557
- function = p .builder .CreateBitCast (function , bitcast .Type (), "" )
557
+ function = p .builder .CreateBitCast (function , inttoptr .Type (), "" )
558
558
}
559
- bitcast .ReplaceAllUsesWith (function )
560
- bitcast .EraseFromParentAsInstruction ()
559
+ inttoptr .ReplaceAllUsesWith (function )
560
+ inttoptr .EraseFromParentAsInstruction ()
561
561
use .EraseFromParentAsInstruction ()
562
562
}
563
563
0 commit comments