mirror of
https://github.com/apple/swift.git
synced 2025-12-14 20:36:38 +01:00
This patch replaces the stateful generation of SILScope information in SILGenFunction with data derived from the ASTScope hierarchy, which should be 100% in sync with the scopes needed for local variables. The goal is to eliminate the surprising effects that the stack of cleanup operations can have on the current state of SILBuilder leading to a fully deterministic (in the sense of: predictible by a human) association of SILDebugScopes with SILInstructions. The patch also eliminates the need to many workarounds. There are still some accomodations for several Sema transformation passes such as ResultBuilders, which don't correctly update the source locations when moving around nodes. If these were implemented as macros, this problem would disappear. This necessary rewrite of the macro scope handling included in this patch also adds proper support nested macro expansions. This fixes rdar://88274783 and either fixes or at least partially addresses the following: rdar://89252827 rdar://105186946 rdar://105757810 rdar://105997826 rdar://105102288
23 lines
1.0 KiB
Plaintext
23 lines
1.0 KiB
Plaintext
// RUN: %target-swift-frontend %s -g -emit-ir -o - | %FileCheck %s
|
|
|
|
sil_stage canonical
|
|
|
|
import Builtin
|
|
import Swift
|
|
|
|
sil [ossa] @square : $@convention(thin) (Int32) -> Int32 {
|
|
bb0(%0 : $Int32):
|
|
debug_value %0 : $Int32, let, name "x" // id: %1
|
|
%3 = struct_extract %0 : $Int32, #Int32._value // user: %6
|
|
%4 = struct_extract %0 : $Int32, #Int32._value // user: %6
|
|
%5 = integer_literal $Builtin.Int1, -1 // user: %6
|
|
%6 = builtin "smul_with_overflow_Int32"(%3 : $Builtin.Int32, %4 : $Builtin.Int32, %5 : $Builtin.Int1) : $(Builtin.Int32, Builtin.Int1) // users: %7, %8
|
|
%7 = tuple_extract %6 : $(Builtin.Int32, Builtin.Int1), 0 // user: %10
|
|
%8 = tuple_extract %6 : $(Builtin.Int32, Builtin.Int1), 1 // user: %9
|
|
cond_fail %8 : $Builtin.Int1 // id: %9
|
|
%10 = struct $Int32 (%7 : $Builtin.Int32) // user: %11
|
|
// CHECK: ret i32 %{{.*}}, !dbg ![[LOC:.*]]
|
|
// CHECK: ![[LOC]] = !DILocation(line: [[@LINE+1]],
|
|
return %10 : $Int32 // id: %11
|
|
}
|