summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorHeejin Ahn <aheejin@gmail.com>2019-12-11 14:49:31 -0800
committerGitHub <noreply@github.com>2019-12-11 14:49:31 -0800
commitacd786dbd1e59f9d105c4ec8603c2ff46f233649 (patch)
treead9bd1806729dfd2c6973929d57d7aa9ee756fc9 /src
parent8dd1b2d545ea5ecf6bce90ce726dd95d319b5d63 (diff)
downloadbinaryen-acd786dbd1e59f9d105c4ec8603c2ff46f233649.tar.gz
binaryen-acd786dbd1e59f9d105c4ec8603c2ff46f233649.tar.bz2
binaryen-acd786dbd1e59f9d105c4ec8603c2ff46f233649.zip
Fix loop parent computation in DataFlow.Graph (#2522)
This fixes the parent-child relationship computation in `DataFlow.Graph` when there is a loop. This wasn't discovered until now because this is used in Souperify and Souperify only runs after Flatten pass, which produces redundant blocks between inside and outside of a loop.
Diffstat (limited to 'src')
-rw-r--r--src/dataflow/graph.h3
1 files changed, 3 insertions, 0 deletions
diff --git a/src/dataflow/graph.h b/src/dataflow/graph.h
index 873c4f218..41b145ee9 100644
--- a/src/dataflow/graph.h
+++ b/src/dataflow/graph.h
@@ -278,6 +278,9 @@ struct Graph : public UnifiedExpressionVisitor<Graph, Node*> {
return &bad;
}
Node* doVisitLoop(Loop* curr) {
+ auto* oldParent = parent;
+ expressionParentMap[curr] = oldParent;
+ parent = curr;
// As in Souper's LLVM extractor, we avoid loop phis, as we don't want
// our traces to represent a value that differs across loop iterations.
// For example,