diff --git a/lib/SIL/Utils/FieldSensitivePrunedLiveness.cpp b/lib/SIL/Utils/FieldSensitivePrunedLiveness.cpp index 70057c934a70f..04b2edce9f921 100644 --- a/lib/SIL/Utils/FieldSensitivePrunedLiveness.cpp +++ b/lib/SIL/Utils/FieldSensitivePrunedLiveness.cpp @@ -148,6 +148,12 @@ SubElementOffset::computeForAddress(SILValue projectionDerivedFromRoot, continue; } + if (auto *uaci = + dyn_cast(projectionDerivedFromRoot)) { + projectionDerivedFromRoot = uaci->getOperand(); + continue; + } + if (auto *sbi = dyn_cast(projectionDerivedFromRoot)) { projectionDerivedFromRoot = sbi->getDest(); continue; diff --git a/test/SILOptimizer/moveonly_addresschecker.swift b/test/SILOptimizer/moveonly_addresschecker.swift index f3331c0f84da9..77e60aef57c22 100644 --- a/test/SILOptimizer/moveonly_addresschecker.swift +++ b/test/SILOptimizer/moveonly_addresschecker.swift @@ -2,22 +2,27 @@ // RUN: -enable-experimental-feature NoImplicitCopy \ // RUN: -enable-experimental-feature MoveOnlyClasses \ // RUN: -enable-experimental-feature LifetimeDependence \ +// RUN: -enable-experimental-feature BuiltinModule \ // RUN: -Xllvm -sil-print-final-ossa-module %s | %FileCheck %s // RUN: %target-swift-emit-sil -O -sil-verify-all -verify \ // RUN: -enable-experimental-feature NoImplicitCopy \ // RUN: -enable-experimental-feature MoveOnlyClasses \ // RUN: -enable-experimental-feature LifetimeDependence \ +// RUN: -enable-experimental-feature BuiltinModule \ // RUN: %s // REQUIRES: swift_feature_MoveOnlyClasses // REQUIRES: swift_feature_NoImplicitCopy // REQUIRES: swift_feature_LifetimeDependence +// REQUIRES: swift_feature_BuiltinModule // This file contains tests that used to crash due to verifier errors. It must // be separate from moveonly_addresschecker_diagnostics since when we fail on // the diagnostics in that file, we do not actually run the verifier. +import Builtin + struct TestTrivialReturnValue : ~Copyable { var i: Int = 5 @@ -76,3 +81,10 @@ struct TestCoroAccessorOfCoroAccessor : ~Copyable & ~Escapable { } } } + +@usableFromInline +internal func unsafeBitCast( + _ x: consuming T, to type: U.Type +) -> U { + Builtin.reinterpretCast(x) +}