Skip to content

Commit ab89af6

Browse files
authored
Merge pull request #89917 from augusto2112/rev-enable-sil-verify-debug-value-type-chain
2 parents 7443610 + 201d36b commit ab89af6

7 files changed

Lines changed: 16 additions & 9 deletions

File tree

lib/SIL/Verifier/SILVerifier.cpp

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -87,6 +87,11 @@ static llvm::cl::opt<bool> VerifyDIHoles("verify-di-holes", llvm::cl::init(
8787
#endif
8888
));
8989

90+
// Verify the type chain of debug_value instructions. Disabled by default
91+
// while we fix all root causes.
92+
static llvm::cl::opt<bool> VerifyDebugValueExpr("verify-debug-value-expr",
93+
llvm::cl::init(false));
94+
9095
static llvm::cl::opt<bool> SkipConvertEscapeToNoescapeAttributes(
9196
"verify-skip-convert-escape-to-noescape-attributes", llvm::cl::init(false));
9297

@@ -1959,7 +1964,9 @@ class SILVerifier : public SILVerifierBase<SILVerifier> {
19591964
}
19601965

19611966
// Type chain: SSA operand -> DebugBB -> deref -> fragments -> vartype
1962-
require(inst->isExprTypeValid(), "debug_value type chain should hold");
1967+
if (VerifyDebugValueExpr)
1968+
require(inst->isExprTypeValid(),
1969+
"debug_value type chain should hold");
19631970
}
19641971

19651972
void checkInstructionsDebugInfo(SILInstruction *inst) {

test/Concurrency/silisolationinfo_inference.sil

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1356,7 +1356,7 @@ bb0(%0 : @guaranteed $MainActorIsolatedStruct):
13561356
sil [ossa] @test_nonisolated_unsafe_field_override_struct_addr : $@convention(thin) (@in_guaranteed MainActorIsolatedStruct) -> () {
13571357
bb0(%0 : $*MainActorIsolatedStruct):
13581358
specify_test "sil_isolation_info_inference @trace[0]"
1359-
debug_value %0 : $*MainActorIsolatedStruct, let, name "self", expr op_deref
1359+
debug_value %0 : $*MainActorIsolatedStruct, let, name "self"
13601360
%1 = struct_element_addr %0 : $*MainActorIsolatedStruct, #MainActorIsolatedStruct.nsNonisolatedUnsafe
13611361
debug_value [trace] %1
13621362
%9999 = tuple ()
@@ -1370,7 +1370,7 @@ bb0(%0 : $*MainActorIsolatedStruct):
13701370
sil [ossa] @test_nonisolated_unsafe_field_override_generic_struct_addr : $@convention(thin) <T> (@in_guaranteed MainActorIsolatedGenericStruct<T>) -> () {
13711371
bb0(%0 : $*MainActorIsolatedGenericStruct<T>):
13721372
specify_test "sil_isolation_info_inference @trace[0]"
1373-
debug_value %0 : $*MainActorIsolatedGenericStruct<T>, let, name "self", expr op_deref
1373+
debug_value %0 : $*MainActorIsolatedGenericStruct<T>, let, name "self"
13741374
%1 = struct_element_addr %0 : $*MainActorIsolatedGenericStruct<T>, #MainActorIsolatedGenericStruct.nsNonisolatedUnsafe
13751375
debug_value [trace] %1
13761376
%9999 = tuple ()
@@ -1384,7 +1384,7 @@ bb0(%0 : $*MainActorIsolatedGenericStruct<T>):
13841384
sil [ossa] @test_nonisolated_unsafe_field_override_nonisolated_generic_struct_addr : $@convention(thin) <T> (@in_guaranteed NonisolatedGenericStruct<T>) -> () {
13851385
bb0(%0 : $*NonisolatedGenericStruct<T>):
13861386
specify_test "sil_isolation_info_inference @trace[0]"
1387-
debug_value %0 : $*NonisolatedGenericStruct<T>, let, name "self", expr op_deref
1387+
debug_value %0 : $*NonisolatedGenericStruct<T>, let, name "self"
13881388
%1 = struct_element_addr %0 : $*NonisolatedGenericStruct<T>, #NonisolatedGenericStruct.nsNonisolatedUnsafe
13891389
debug_value [trace] %1
13901390
%9999 = tuple ()

test/DebugInfo/irgen_box_debug_value.sil

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// RUN: %target-swift-frontend -disable-debugger-shadow-copies -g -emit-irgen %s | %FileCheck %s
1+
// RUN: %target-swift-frontend -Xllvm -verify-debug-value-expr -disable-debugger-shadow-copies -g -emit-irgen %s | %FileCheck %s
22
sil_stage canonical
33

44
import Swift

test/SIL/Parser/debug_transform_block.sil

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// RUN: %target-sil-opt -sil-print-types %s | %FileCheck %s
1+
// RUN: %target-sil-opt -sil-print-types -verify-debug-value-expr %s | %FileCheck %s
22
sil_stage canonical
33

44
import Builtin

test/SIL/verifier_failures_debug_transform.sil

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// RUN: %target-sil-opt -sil-print-types -verify-continue-on-failure -o /dev/null %s 2>&1 | %FileCheck %s
1+
// RUN: %target-sil-opt -sil-print-types -verify-debug-value-expr -verify-continue-on-failure -o /dev/null %s 2>&1 | %FileCheck %s
22

33
// REQUIRES: asserts
44

test/SILOptimizer/mark_weak_var_as_sendable.sil

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -382,7 +382,7 @@ bb0(%arg : @owned $C):
382382
// CHECK: } // end sil function 'chained_callee'
383383
sil [ossa] @chained_callee : $@convention(thin) (@guaranteed { var @sil_weak Optional<C> }) -> () {
384384
bb0(%0 : @closureCapture @guaranteed ${ var @sil_weak Optional<C> }):
385-
debug_value %0, var, name "c", argno 1
385+
debug_value %0, var, name "c", argno 1, expr op_deref
386386
%2 = function_ref @simple_callee : $@convention(thin) (@guaranteed { var @sil_weak Optional<C> }) -> ()
387387
%1 = copy_value %0
388388
%3 = partial_apply [callee_guaranteed] %2(%1) : $@convention(thin) (@guaranteed { var @sil_weak Optional<C> }) -> ()

test/SILOptimizer/moveonly_type_eliminator.sil

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -613,7 +613,7 @@ sil [ossa] @existential_metatype : $@convention(thin) (@guaranteed any Error) ->
613613
bb0(%x : @guaranteed $any Error):
614614
%y = copyable_to_moveonlywrapper [guaranteed] %x : $any Error
615615
%em = existential_metatype $@thick any Error.Type, %y : $@moveOnly (any Error)
616-
debug_value %em : $@thick any Error.Type, var, name "s", argno 1
616+
debug_value %em : $@thick any Error.Type, var, name "s", argno 1, expr op_deref
617617
return %em : $@thick any Error.Type
618618
}
619619

0 commit comments

Comments
 (0)