Reduce array abstraction on apple platforms dealing with literals (#13665)

* Reduce array abstraction on apple platforms dealing with literals

Part of the ongoing quest to reduce swift array literal abstraction
penalties: make the SIL optimizer able to eliminate bridging overhead
 when dealing with array literals.

Introduce a new classify_bridge_object SIL instruction to handle the
logic of extracting platform specific bits from a Builtin.BridgeObject
value that indicate whether it contains a ObjC tagged pointer object,
or a normal ObjC object. This allows the SIL optimizer to eliminate
these, which allows constant folding a ton of code. On the example
added to test/SILOptimizer/static_arrays.swift, this results in 4x
less SIL code, and also leads to a lot more commonality between linux
and apple platform codegen when passing an array literal.

This also introduces a couple of SIL combines for patterns that occur
in the array literal passing case.
This commit is contained in:
Chris Lattner
2018-01-02 15:23:48 -08:00
committed by GitHub
parent d847bf5ddd
commit 415cd50ba2
32 changed files with 263 additions and 13 deletions

View File

@@ -1112,6 +1112,7 @@ void SILSerializer::writeSILInstruction(const SILInstruction &SI) {
case SILInstructionKind::LoadUnownedInst:
case SILInstructionKind::LoadWeakInst:
case SILInstructionKind::MarkUninitializedInst:
case SILInstructionKind::ClassifyBridgeObjectInst:
case SILInstructionKind::FixLifetimeInst:
case SILInstructionKind::EndLifetimeInst:
case SILInstructionKind::CopyBlockInst: