summaryrefslogtreecommitdiff
path: root/test/gtest/cfg.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'test/gtest/cfg.cpp')
-rw-r--r--test/gtest/cfg.cpp169
1 files changed, 0 insertions, 169 deletions
diff --git a/test/gtest/cfg.cpp b/test/gtest/cfg.cpp
index 3bb3ec104..9c6e8573a 100644
--- a/test/gtest/cfg.cpp
+++ b/test/gtest/cfg.cpp
@@ -133,175 +133,6 @@ TEST_F(CFGTest, CallBlock) {
EXPECT_EQ(ss.str(), cfgText);
}
-TEST_F(CFGTest, LinearLiveness) {
- auto moduleText = R"wasm(
- (module
- (func $bar
- (local $a (i32))
- (local $b (i32))
- (local $c (i32))
- (local.set $a
- (i32.const 1)
- )
- (drop
- (local.get $a)
- )
- (local.set $b
- (local.get $a)
- )
- (local.set $c
- (i32.const 1)
- )
- (drop
- (local.get $c)
- )
- )
- )
- )wasm";
-
- auto analyzerText = R"analyzer(CFG Analyzer
-CFG Block: 0
-Input State: 000
-Predecessors:
-Successors:
-Intermediate States (reverse order):
-000
-block
-000
-drop
-000
-local.get $2
-001
-local.set $2
-000
-i32.const 1
-000
-local.set $1
-000
-local.get $0
-100
-drop
-100
-local.get $0
-100
-local.set $0
-000
-i32.const 1
-000
-End
-)analyzer";
-
- Module wasm;
- parseWast(wasm, moduleText);
-
- CFG cfg = CFG::fromFunction(wasm.getFunction("bar"));
- size_t numLocals = wasm.getFunction("bar")->getNumLocals();
-
- FiniteIntPowersetLattice lattice(numLocals);
- LivenessTransferFunction transferFunction;
-
- MonotoneCFGAnalyzer<FiniteIntPowersetLattice, LivenessTransferFunction>
- analyzer(lattice, transferFunction, cfg);
- analyzer.evaluate();
-
- std::stringstream ss;
- analyzer.print(ss);
-
- EXPECT_EQ(ss.str(), analyzerText);
-}
-
-TEST_F(CFGTest, NonlinearLiveness) {
- auto moduleText = R"wasm(
- (module
- (func $bar
- (local $a (i32))
- (local $b (i32))
- (local.set $a
- (i32.const 1)
- )
- (if
- (i32.eq
- (local.get $a)
- (i32.const 2)
- )
- (local.set $b
- (i32.const 4)
- )
- (drop
- (local.get $a)
- )
- )
- )
- )
- )wasm";
-
- auto analyzerText = R"analyzer(CFG Analyzer
-CFG Block: 0
-Input State: 10
-Predecessors:
-Successors: 1 2
-Intermediate States (reverse order):
-10
-i32.eq
-10
-i32.const 2
-10
-local.get $0
-10
-local.set $0
-00
-i32.const 1
-00
-CFG Block: 1
-Input State: 00
-Predecessors: 0
-Successors: 3
-Intermediate States (reverse order):
-00
-local.set $1
-00
-i32.const 4
-00
-CFG Block: 2
-Input State: 00
-Predecessors: 0
-Successors: 3
-Intermediate States (reverse order):
-00
-drop
-00
-local.get $0
-10
-CFG Block: 3
-Input State: 00
-Predecessors: 2 1
-Successors:
-Intermediate States (reverse order):
-00
-block
-00
-End
-)analyzer";
-
- Module wasm;
- parseWast(wasm, moduleText);
-
- CFG cfg = CFG::fromFunction(wasm.getFunction("bar"));
- size_t numLocals = wasm.getFunction("bar")->getNumLocals();
-
- FiniteIntPowersetLattice lattice(numLocals);
- LivenessTransferFunction transferFunction;
-
- MonotoneCFGAnalyzer<FiniteIntPowersetLattice, LivenessTransferFunction>
- analyzer(lattice, transferFunction, cfg);
- analyzer.evaluate();
-
- std::stringstream ss;
- analyzer.print(ss);
-
- EXPECT_EQ(ss.str(), analyzerText);
-}
-
TEST_F(CFGTest, FinitePowersetLatticeFunctioning) {
std::vector<std::string> initialSet = {"a", "b", "c", "d", "e", "f"};