Commits

Nadav Rotem committed 16bd6448259
[IRGen] Remove an extra null comparison in 'exact' checked_cast_br. rdar://22666588 This change removes a comparison and a branch on every virtual call. Before this change we were generating code for comparing the metadata to figure out if the incoming instance is an 'exact' cast, and then we checked if the result of the cast was zero. This is unnecessary because we can simply reuse the result of the exact metadata comparison. Moreover, we know that the metadata instance can't be zero because we've emitted a load to that address that did not trap. %1 = getelementptr inbounds %C4main1X, %C4main1X* %0 ... %.metadata = load %swift.type*, %swift.type** %1 // Loading %0 %2 = icmp eq %swift.type* %.metadata, bitcast (...) %3 = icmp ne %C4main1X* %0, null ; <----------- %0 can't be null. %4 = and i1 %3, %2 br i1 %4, label %5, label %7 Swift SVN r31920