Small clean-up. Add createUncheckedBitCast to SILBuilder.

This new method eliminates repeated code sequences that all create an
unchecked_trivial_bit_cast if the result type is trivial or
unchecked_ref_bit_cast otherwise.

NFC.

Swift SVN r29486
This commit is contained in:
Mark Lacey
2015-06-18 07:30:42 +00:00
parent a065ae99c8
commit 75b5b1248e
5 changed files with 31 additions and 41 deletions

View File

@@ -3000,12 +3000,8 @@ static bool emitOptimizedOptionalEvaluation(OptionalEvaluationExpr *E,
if (optInit == nullptr) {
auto subMV = SGF.emitRValueAsSingleValue(BO->getSubExpr());
SILValue result;
if (optTL.isTrivial())
result = SGF.B.createUncheckedTrivialBitCast(E, subMV.forward(SGF),
optTL.getLoweredType());
else
result = SGF.B.createUncheckedRefBitCast(E, subMV.forward(SGF),
optTL.getLoweredType());
result = SGF.B.createUncheckedBitCast(E, subMV.forward(SGF),
optTL.getLoweredType());
LoadableResult = result;
return true;