File tree Expand file tree Collapse file tree 1 file changed +8
-1
lines changed Expand file tree Collapse file tree 1 file changed +8
-1
lines changed Original file line number Diff line number Diff line change 1
1
#include < cassert>
2
2
#include < cstddef>
3
3
#include < map>
4
+ #include < optional>
4
5
5
6
#include " MergeSSA.hpp"
6
7
#include " SSAObj.hpp"
@@ -53,7 +54,13 @@ void MergeSSA::runOnFunction(wasm::Module *m, wasm::Function *func) {
53
54
if (auto *const getExpr = callExpr->operands [0 ]->dynCast <wasm::LocalGet>()) {
54
55
// this tmp ssa is reference of local
55
56
wasm::Index const localIndex = getExpr->index ;
56
- Liveness const localgetLiveness = livenessMap.getLiveness (getExpr).value ();
57
+ std::optional<Liveness> const liveness = livenessMap.getLiveness (getExpr);
58
+ if (liveness == std::nullopt )
59
+ // this expr are unreachable, so CFG will not contain it.
60
+ // we just skip this node and let other optimization handle it.
61
+ // FIXME: maybe we should do pre-opt to remove the dead code?
62
+ continue ;
63
+ Liveness const localgetLiveness = liveness.value ();
57
64
58
65
DynBitset const localMappedSSA = localIndexToSSA.get (localIndex);
59
66
DynBitset const livenessBeforeLocalGet = localgetLiveness.before () & localMappedSSA;
You can’t perform that action at this time.
0 commit comments