Commits

Slava Pestov committed e6f8195d9c2
IRGen: Get scalar casts with existential result type working emitScalarExistentialDowncast() would return an explosion consisting of the original input value, followed by witness tables returned by calling emitExistentialScalarCastFn(). The result of this explosion was then tested by comparing the first element against NULL, which is wrong, since the first element was set to the input value unconditionally. Address this by changing the dynamic cast functions to take the value as the first argument, and return it as the first element of the return tuple. The value is not used directly, only set to NULL if the cast fails. This makes the NULL check in visitCheckedCastBranchInst() work as intended. Note that now the result of the cast becomes a different LLVM value than the input. With the dynamic cast function inlined, this should not be an issue, since this is already the case for dynamic class cast. There are also perhaps too many bitcast instructions generated now. This could be cleaned up. Fixes <rdar://problem/20920874>. Swift SVN r28712