Avoid recursion in InstNamer::CollectNamesInBlock (#4706)

Use a deque to maintain the set of instructions to be walked over. so
that the loop can append more instructions (with their related scope)
during iteration without requiring recursion.

---------

Co-authored-by: jonmeow <jperkins@google.com>
This commit is contained in:
Dana Jansens
2024-12-20 16:12:06 +00:00
committed by GitHub
co-authored by jonmeow
parent aca862ceff
commit 6cb660f5ad
92 changed files with 974 additions and 955 deletions
+3 -3
View File
@@ -65,10 +65,10 @@ fn F(b: bool, n: i32, m: i32) -> i32 {
// CHECK:STDOUT: %int_32.loc11_34: Core.IntLiteral = int_value 32 [template = constants.%int_32]
// CHECK:STDOUT: %i32.loc11_34: type = class_type @Int, @Int(constants.%int_32) [template = constants.%i32]
// CHECK:STDOUT: %b.param: bool = value_param runtime_param0
// CHECK:STDOUT: %.loc11_9.3: type = splice_block %.loc11_9.2 [template = bool] {
// CHECK:STDOUT: %.loc11_9.1: type = splice_block %.loc11_9.3 [template = bool] {
// CHECK:STDOUT: %bool.make_type: init type = call constants.%Bool() [template = bool]
// CHECK:STDOUT: %.loc11_9.1: type = value_of_initializer %bool.make_type [template = bool]
// CHECK:STDOUT: %.loc11_9.2: type = converted %bool.make_type, %.loc11_9.1 [template = bool]
// CHECK:STDOUT: %.loc11_9.2: type = value_of_initializer %bool.make_type [template = bool]
// CHECK:STDOUT: %.loc11_9.3: type = converted %bool.make_type, %.loc11_9.2 [template = bool]
// CHECK:STDOUT: }
// CHECK:STDOUT: %b: bool = bind_name b, %b.param
// CHECK:STDOUT: %n.param: %i32 = value_param runtime_param1