* fixes #20572

* added a test case
This commit is contained in:
Andreas Rumpf 2022-10-17 23:48:51 +02:00 • committed by GitHub
commit 81087c949f
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
25 changed files with 116 additions and 70 deletions

View file

@ -686,7 +686,7 @@ proc traverse(c: var Partitions; n: PNode) =
for i in 0..<child.len-2:
#registerVariable(c, child[i])
deps(c, child[i], last)
of nkAsgn, nkFastAsgn:
of nkAsgn, nkFastAsgn, nkSinkAsgn:
traverse(c, n[0])
inc c.inAsgnSource
traverse(c, n[1])
@ -779,7 +779,7 @@ proc traverse(c: var Partitions; n: PNode) =
if n.kind == nkWhileStmt:
traverse(c, n[0])
# variables in while condition has longer alive time than local variables
# variables in while condition has longer alive time than local variables
# in the while loop body
else:
for child in n: traverse(c, child)
@ -811,7 +811,7 @@ proc computeLiveRanges(c: var Partitions; n: PNode) =
registerVariable(c, child[i])
#deps(c, child[i], last)
of nkAsgn, nkFastAsgn:
of nkAsgn, nkFastAsgn, nkSinkAsgn:
computeLiveRanges(c, n[0])
computeLiveRanges(c, n[1])
if n[0].kind == nkSym:
@ -871,7 +871,7 @@ proc computeLiveRanges(c: var Partitions; n: PNode) =
if n.kind == nkWhileStmt:
computeLiveRanges(c, n[0])
# variables in while condition has longer alive time than local variables
# variables in while condition has longer alive time than local variables
# in the while loop body
of nkElifBranch, nkElifExpr, nkElse, nkOfBranch:
inc c.inConditional