swiftlang/swift

[SR-1111] Non-optimized builds should avoid redundant thick_to_objc_metatype conversions

Open

#43.724 geöffnet am 30. März 2016

Auf GitHub ansehen
 (0 Kommentare) (0 Reaktionen) (0 zugewiesene Personen)Swift (10.719 Forks)batch import
IRGencompilergood first issueimprovementnon-optimized only

Repository-Metriken

Stars
 (69.989 Stars)
PR-Merge-Metriken
 (Durchschn. Merge 8T 17h) (510 gemergte PRs in 30 T)

Beschreibung

Previous ID SR-1111
Radar None
Original Reporter @belkadan
Type Improvement
Votes 0
Component/s Compiler
Labels Improvement, IRGen, NotOptimizedOnly, StarterBug
Assignee None
Priority Medium

md5: ee5fa37243b2596a51a6125675863696

Issue Description:

In this code:

import Foundation
func test() -> Bool {
  let a = RunLoop.current
  let b = RunLoop.main
  return a === b
}

We're smart enough to avoid emitting two references to the metadata for NSRunLoop, but not smart enough (in -Onone builds) to avoid emitting the conversion to an ObjC Class twice, which involves a branch. We should be able to reuse the value from the first thick_to_objc_metatype conversion.

Contributor Guide