swiftlang/swift
Vedi su GitHub[SR-1103] Redundant metadata accesses when invoking ObjC protocol methods
Open
#43.716 aperta il 29 mar 2016
IRGenbugcompilergood first issue
Metriche repository
- Star
- (69.989 star)
- Metriche merge PR
- (Merge medio 8g 17h) (510 PR mergiate in 30 g)
Descrizione
| Previous ID | SR-1103 |
| Radar | None |
| Original Reporter | @jckarter |
| Type | Bug |
| Votes | 0 |
| Component/s | Compiler |
| Labels | Bug, IRGen, StarterBug |
| Assignee | None |
| Priority | Medium |
md5: 970c1d7db6290aee45b5ecc9fd1e9432
Issue Description:
Protocol methods are modeled as functions generic on Self, so IRGen tries to get the type metadata to satisfy the formal type parameter, even though it's not used for an ObjC or C protocol method:
define void @invoke_protocol_methods(%objc_object*) #​0 {
entry:
%.Type = call %swift.type* @swift_getObjectType(%objc_object* %0) #​2
%1 = bitcast %objc_object* %0 to i8*
call void @mutateSomeState(i8* %1)
ret void
}
The call is marked readnone so gets optimized away, but we shouldn't emit it at all for the sake of unoptimized code.