Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions src/dataflow/graph.h
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
26 changes: 26 additions & 0 deletions test/passes/souperify.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@

; function: if-loop-test

; start LHS (in if-loop-test)
%0 = sub 0:i32, 0:i32
%1 = ne 0:i32, 0:i32
pc %1 1:i1
infer %0

(module
(type $FUNCSIG$v (func))
(func $if-loop-test (; 0 ;) (type $FUNCSIG$v)
(local $0 i32)
(if
(i32.const 0)
(loop $label$0
(local.set $0
(i32.sub
(i32.const 0)
(i32.const 0)
)
)
)
)
)
)
17 changes: 17 additions & 0 deletions test/passes/souperify.wast
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
(module
;; This tests if we can create dataflow graph correctly in the presence of
;; loops.
(func $if-loop-test (local $0 i32)
(if
(i32.const 0)
(loop $label$0
(local.set $0
(i32.sub
(i32.const 0)
(i32.const 0)
)
)
)
)
)
)