Skip to content

Commit be8a01b

Browse files
committed
work
1 parent e7edd34 commit be8a01b

1 file changed

Lines changed: 6 additions & 6 deletions

File tree

src/passes/Flatten.cpp

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,7 @@ struct LowerUnflattenable : public PostWalker<LowerUnflattenable> {
9898
condition = builder.makeRefIsNull(refTee);
9999
flip = true;
100100
brValue = builder.makeRefAs(RefAsNonNull, getRef());
101-
flowValue = getRef();
101+
// No value flos out.
102102
break;
103103
}
104104
case BrOnCast: {
@@ -125,9 +125,11 @@ struct LowerUnflattenable : public PostWalker<LowerUnflattenable> {
125125
}
126126

127127
auto* br = builder.makeBreak(curr->name, brValue);
128-
auto* iff = builder.makeIf(condition, br);
129-
auto* seq = builder.makeSequence(iff, flowValue);
130-
replaceCurrent(seq);
128+
Expression* result = builder.makeIf(condition, br);
129+
if (flowValue) {
130+
result = builder.makeSequence(result, flowValue);
131+
}
132+
replaceCurrent(result);
131133
}
132134

133135
void replaceUnreachableWithDrops() {
@@ -464,8 +466,6 @@ struct Flatten
464466
// Lower things before the main walk.
465467
LowerUnflattenable(*getModule(), getPassOptions()).walkFunction(curr);
466468

467-
std::cout << "after " << *curr << '\n';
468-
469469
WalkerPass<
470470
ExpressionStackWalker<Flatten, UnifiedExpressionVisitor<Flatten>>>::
471471
doWalkFunction(curr);

0 commit comments

Comments
 (0)