aboutsummaryrefslogtreecommitdiffhomepage
path: root/tensorflow/python/autograph/pyct/cfg.py
diff options
context:
space:
mode:
authorGravatar Dan Moldovan <mdan@google.com>2018-10-09 09:34:47 -0700
committerGravatar TensorFlower Gardener <gardener@tensorflow.org>2018-10-09 09:53:26 -0700
commit3ef35b81fd753401e3d69989b3bd1146749cc3b3 (patch)
tree3db4c4f9fdfaa85f5f7907f5fb0a2ad5bafb45ad /tensorflow/python/autograph/pyct/cfg.py
parent5d6adc910b8323b73a61d3089f3a3028be411e90 (diff)
Include live-in symbols in liveness analysis. These are required for control flow conversion.
PiperOrigin-RevId: 216370439
Diffstat (limited to 'tensorflow/python/autograph/pyct/cfg.py')
-rw-r--r--tensorflow/python/autograph/pyct/cfg.py10
1 files changed, 7 insertions, 3 deletions
diff --git a/tensorflow/python/autograph/pyct/cfg.py b/tensorflow/python/autograph/pyct/cfg.py
index fca0eb62e4..ec733ea38f 100644
--- a/tensorflow/python/autograph/pyct/cfg.py
+++ b/tensorflow/python/autograph/pyct/cfg.py
@@ -22,6 +22,10 @@ Once built, the CFG itself is immutable, but the values it holds need not be;
they are usually annotated with information extracted by walking the graph.
"""
+# TODO(mdan): The notion of 'statements' below is inaccurate.
+# They should rather be called 'block statements', because they include
+# statements that may have a body, e.g. if and while.
+
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
@@ -763,9 +767,9 @@ class AstToCfg(gast.NodeVisitor):
self.builder.enter_section(node)
- # TODO(mdan): Strictly speaking, this should be node.target + node.iter.
- # A blind dataflow analysis would have to process both node.target and
- # node.iter to properly process read and write access.
+ # Note: Strictly speaking, this should be node.target + node.iter.
+ # However, the activity analysis accounts for this inconsistency,
+ # so dataflow analysis produces the correct values.
self.builder.enter_loop_section(node, node.iter)
for stmt in node.body:
self.visit(stmt)