summary refs log tree commit diff stats
diff options
context:
space:
mode:
authorAndreas Rumpf <rumpf_a@web.de>2019-01-21 20:11:42 +0100
committerAndreas Rumpf <rumpf_a@web.de>2019-01-23 11:08:51 +0100
commit2655f242a838a5845a71bc4857cbc4a7df297eb6 (patch)
treecf20245e6da0614ccd6cf317e8dc46d5bee48cfc
parent112f7e650aad3200b123174d8d835f989e707fcb (diff)
downloadNim-2655f242a838a5845a71bc4857cbc4a7df297eb6.tar.gz
use the lastRead analysis; it's correct by construction, not a mess of special cases and seems to be just as fast as the old algorithm
-rw-r--r--compiler/destroyer.nim4
1 files changed, 2 insertions, 2 deletions
diff --git a/compiler/destroyer.nim b/compiler/destroyer.nim
index a97b49dac..06d4dcbef 100644
--- a/compiler/destroyer.nim
+++ b/compiler/destroyer.nim
@@ -176,8 +176,8 @@ proc isLastRead(n: PNode; c: var Con): bool =
   # we go through all paths beginning from 'instr+1' and need to
   # ensure that we don't find another 'use X' instruction.
   if instr+1 >= c.g.len: return true
-  when false:
-    result = isLastRead(n.sym, c, 0, -1) >= 0
+  when true:
+    result = isLastRead(n.sym, c, instr+1, -1) >= 0
   else:
     let s = n.sym
     var pcs: seq[int] = @[instr+1]