Skip to content

Commit 4316a7c

Browse files
committed
ConstExpr: look through sendable function conversions
1 parent 4e61c56 commit 4316a7c

File tree

3 files changed

+3
-3
lines changed

3 files changed

+3
-3
lines changed

lib/SILOptimizer/Utils/ConstExpr.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -520,7 +520,7 @@ SymbolicValue ConstExprFunctionState::computeConstantValue(SILValue value) {
520520
// TODO: Certain covariant or otherwise ABI-compatible conversions should
521521
// be handled as well.
522522
if (auto cf = dyn_cast<ConvertFunctionInst>(value)) {
523-
if (cf->onlyConvertsSubstitutions()) {
523+
if (cf->onlyConvertsSubstitutions() || cf->onlyConvertsSendable()) {
524524
return getConstantValue(cf->getOperand());
525525
}
526526
}

test/SILOptimizer/constant_evaluable_profiler_test.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
// RUN: %empty-directory(%t)
2-
// RUN: %target-swift-frontend -profile-generate -emit-silgen -primary-file %S/Inputs/constant_evaluable.swift -o %t/constant_evaluable_profiler_test_silgen.sil
2+
// RUN: %target-swift-frontend -profile-generate -enable-upcoming-feature InferSendableFromCaptures -emit-silgen -primary-file %S/Inputs/constant_evaluable.swift -o %t/constant_evaluable_profiler_test_silgen.sil
33
//
44
// Run the (mandatory) passes on which constant evaluator depends, and test the
55
// constant evaluator on the SIL produced after the dependent passes are run.

test/SILOptimizer/constant_evaluable_subset_test.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
// RUN: %empty-directory(%t)
2-
// RUN: %target-swift-frontend -emit-silgen -primary-file %S/Inputs/constant_evaluable.swift -o %t/constant_evaluable_subset_test_silgen.sil
2+
// RUN: %target-swift-frontend -enable-upcoming-feature InferSendableFromCaptures -emit-silgen -primary-file %S/Inputs/constant_evaluable.swift -o %t/constant_evaluable_subset_test_silgen.sil
33
//
44
// Run the (mandatory) passes on which constant evaluator depends, and test the
55
// constant evaluator on the SIL produced after the dependent passes are run.

0 commit comments

Comments
 (0)